Author: tmckay
Date: 2011-02-18 22:46:34 +0000 (Fri, 18 Feb 2011)
New Revision: 4539
Modified:
trunk/cumin/bin/cumin
trunk/cumin/etc/sysvinit-cumin
Log:
Write notes to stderr, check for extra arguments in cumin.
Direct stderr to /dev/null in init.d checks.
Modified: trunk/cumin/bin/cumin
===================================================================
--- trunk/cumin/bin/cumin 2011-02-18 21:19:34 UTC (rev 4538)
+++ trunk/cumin/bin/cumin 2011-02-18 22:46:34 UTC (rev 4539)
@@ -21,9 +21,6 @@
else:
signal.signal(signal.SIGTERM, func)
-class InitCheckException(Exception):
- pass
-
def main():
# tuple indices, for clarity
@@ -44,6 +41,12 @@
"\nEach value implies a separate cumin-data
instance.")
(options, args) = parser.parse_args()
+ if len(args) != 0:
+ sys.stderr.write("cumin: extra args: ")
+ for a in args:
+ sys.stderr.write(a+" ")
+ sys.stderr.write("\n")
+ return 1
# Get our list of cumin-web and data instances
# create list elements to hold the process object, section arg, and app
@@ -62,7 +65,8 @@
app[PROCESS] = subprocess.Popen(arg)
exit_code = app[PROCESS].wait()
if exit_code != 0:
- raise InitCheckException
+ sys.stderr.write("cumin: --init-only check failed\n")
+ return 1
else:
# Launch and babysit
try:
@@ -84,6 +88,6 @@
# run the finally block anyway.
set_exit_handler(call_sys_exit)
try:
- main()
+ sys.exit(main())
except KeyboardInterrupt:
pass
Modified: trunk/cumin/etc/sysvinit-cumin
===================================================================
--- trunk/cumin/etc/sysvinit-cumin 2011-02-18 21:19:34 UTC (rev 4538)
+++ trunk/cumin/etc/sysvinit-cumin 2011-02-18 22:46:34 UTC (rev 4539)
@@ -42,7 +42,8 @@
[ $? -eq 0 ] && success && echo && return
# Invoke in foreground with arguments to test validity, if args have been set
if [ -n "$CUMIN_OPTIONS" ] ; then
- daemon --user cumin --check $servicename $processname "--init-only
"$CUMIN_OPTIONS
+ daemon --user cumin --check $servicename $processname \
+ "--init-only "$CUMIN_OPTIONS 2> /dev/null
[ $? -ne 0 ] && failure && echo && return
fi
# Launch for real now...
Show replies by date