Author: tmckay Date: 2011-03-01 15:05:45 +0000 (Tue, 01 Mar 2011) New Revision: 4562
Modified: trunk/cumin/bin/cumin trunk/cumin/etc/sysvinit-cumin Log: Initially redirect IO in the init.d script to /dev/null to make sure test scripts don't hang on file descriptors. Redirect IO to log files from cumin after start. (Tweaks related to BZ672583)
Modified: trunk/cumin/bin/cumin =================================================================== --- trunk/cumin/bin/cumin 2011-02-28 19:36:14 UTC (rev 4561) +++ trunk/cumin/bin/cumin 2011-03-01 15:05:45 UTC (rev 4562) @@ -61,12 +61,12 @@ "\nEach value implies a separate cumin-data instance.")
parser.add_option("--console", dest="console", action="store_true", default=False, - help="Do not redirect stderr or stdout, and log to stderr.") + help="Log to stderr rather than master.log, no other IO redirection.")
parser.add_option("--devel", dest="devel", action="store_true", default=False, help="Option is ignored if --console is set."\ "\nRedirect stderr and stdout to files in "\ - "$CUMIN_HOME/log if set and to /dev/null if not set.") + "$CUMIN_HOME/log.")
# Trap exit from parser and save standard error for logging # Then put stderr back to original value @@ -93,12 +93,11 @@ enable_logging("cumin.master", logging.INFO, sys.stderr) else: enable_logging("cumin.master", logging.INFO, os.path.join(home, "log", "master.log")) - new_stdin = open(os.devnull,"r") if devel: new_stderr = open(os.path.join(home, "log", "master.stderr"), "a") new_stdout = open(os.path.join(home, "log", "master.stdout"), "a") - else: - new_stderr = new_stdout = open(os.devnull,"w") + sys.stderr = new_stderr + sys.stdout = new_stdout
# Parser exited, either on --help or with errors if options == None:
Modified: trunk/cumin/etc/sysvinit-cumin =================================================================== --- trunk/cumin/etc/sysvinit-cumin 2011-02-28 19:36:14 UTC (rev 4561) +++ trunk/cumin/etc/sysvinit-cumin 2011-03-01 15:05:45 UTC (rev 4562) @@ -39,16 +39,21 @@ echo -n $"Starting cumin: " # If it's already running, be happy and return success status $processname &> /dev/null - [ $? -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 - [ $? -ne 0 ] && failure && echo && return + [ $? -eq 0 ] && echo_success && echo && return + + # Invoke in foreground with arguments to test validity. + # Leave stderr alone, so that something like an import error or a missing + # module will still be seen. + daemon --user cumin --check $servicename $processname \ + "--init-only "$CUMIN_OPTIONS < /dev/null > /dev/null + if [ $? -ne 0 ] ; then + echo_failure; echo; return fi - # Launch for real now... - daemon --user cumin --check $servicename $processname $CUMIN_OPTIONS & - [ $? -eq 0 ] && touch /var/lock/subsys/$servicename && echo + + # Launch for real now...Since we already did an init check assume success + # Squelch all IO, let cumin redirect. + daemon --user cumin --check $servicename $processname $CUMIN_OPTIONS < /dev/null &> /dev/null & + echo_success && touch /var/lock/subsys/$servicename && echo }
stop() {
cumin-developers@lists.fedorahosted.org