diff --git a/clientside/os/frisbee.redux/mserver.c b/clientside/os/frisbee.redux/mserver.c index 81ca5690d646eccf76b6a7b77f776e2256e7cdf1..3e1c04f1f0e16cdf3dd7c58c916520798490e1e8 100644 --- a/clientside/os/frisbee.redux/mserver.c +++ b/clientside/os/frisbee.redux/mserver.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 University of Utah and the Flux Group. + * Copyright (c) 2010-2013 University of Utah and the Flux Group. * * {{{EMULAB-LICENSE * @@ -114,7 +114,13 @@ main(int argc, char **argv) myuid = geteuid(); mygid = getegid(); - MasterServerLogInit(); + if (daemonize && debug) { + int odebug = debug; + debug = 0; + MasterServerLogInit(); + debug = odebug; + } else + MasterServerLogInit(); log("mfrisbeed daemon starting as %d/%d, methods=%s (debug level %d)", myuid, mygid, GetMSMethods(onlymethods), debug); @@ -1342,7 +1348,7 @@ usage(void) fprintf(stderr, " -p <port> port to listen on\n"); fprintf(stderr, "Debug:\n"); fprintf(stderr, " -d debug mode; does not daemonize\n"); - fprintf(stderr, " -D dump configuration and exit\n"); + fprintf(stderr, " -D force daemonizing even with debug\n"); fprintf(stderr, "Proxying:\n"); fprintf(stderr, " -S <parent> parent name or IP\n"); fprintf(stderr, " -P <pport> parent port to contact\n"); @@ -1356,6 +1362,7 @@ static void get_options(int argc, char **argv) { int ch; + int forcedaemonize = 0; while ((ch = getopt(argc, argv, "AC:O:DI:MRX:x:S:P:p:i:dhQ:")) != -1) switch(ch) { @@ -1413,7 +1420,7 @@ get_options(int argc, char **argv) debug++; break; case 'D': - dumpconfig = 1; + forcedaemonize = 1; break; case 'I': { @@ -1482,6 +1489,9 @@ get_options(int argc, char **argv) "Error: Must specify a parent (-S) in mirror mode\n"); usage(); } + + if (forcedaemonize) + daemonize = 1; } /* diff --git a/rc.d/3.mfrisbeed-subboss.sh.in b/rc.d/3.mfrisbeed-subboss.sh.in index 32647a63166758afee1970ed0b03e6e3c4ed5696..f27a61a056f2ef53b893d7be032ef5ad4540cbdf 100644 --- a/rc.d/3.mfrisbeed-subboss.sh.in +++ b/rc.d/3.mfrisbeed-subboss.sh.in @@ -13,6 +13,12 @@ #MCBASEADDR="" MCBASEADDR="239.192.1" +# +# Set to run with debugging enabled. +# +#DEBUG= +DEBUG=yes + # # Start up the frisbee master server on a subboss. # There is no sure fire way to dynamically tell if we are a subboss right now. @@ -65,11 +71,16 @@ esac echo -n " mfrisbeed" rm -f /var/run/frisbeed-*.pid + args="-C null -S @BOSSNODE_IP@ -I /z/image_cache -A -M -R" if [ -n "$MCBASEADDR" ]; then args="$args -O mcaddr=$MCBASEADDR" fi -if [ -x @prefix@/sbin/daemon_wrapper ]; then +if [ -n "$DEBUG" ]; then + args="-ddD $args" +fi + +if [ -z "$DEBUG" -a -x @prefix@/sbin/daemon_wrapper ]; then @prefix@/sbin/daemon_wrapper -i 30 -l @prefix@/log/mfrisbeed_wrapper.log \ @prefix@/sbin/mfrisbeed -d $args else diff --git a/rc.d/3.mfrisbeed.sh.in b/rc.d/3.mfrisbeed.sh.in index b6af6584ddeaf4882db222542539753327796599..c4d1712c3078c59fe67adebbf5c78f3627fa8f5e 100644 --- a/rc.d/3.mfrisbeed.sh.in +++ b/rc.d/3.mfrisbeed.sh.in @@ -6,7 +6,13 @@ # KEYWORD: shutdown # -# Start up the frisbee master server. +# Set to run with debugging enabled. +# +#DEBUG= +DEBUG=yes + +# +# Start up the frisbee master server on boss. # We run it under the daemon wrapper if available so that it will get # automatically restarted. # @@ -71,19 +77,19 @@ rm -f /var/run/frisbeed-*.pid args="-C emulab -i @BOSSNODE_IP@" # to allow broadcast, uncomment the following line #args="$args -x ucast,mcast,bcast" - # if an inner elab, use outer boss as our parent if [ -n "@OUTERBOSS_NODENAME@" ]; then args="$args -S @OUTERBOSS_NODENAME@" fi - # see if we need to be an IGMP querier if [ "@NEEDMCQUERIER@" = "1" ]; then args="$args -Q 30" fi +if [ -n "$DEBUG" ]; then + args="-ddD $args" +fi -# XXX I am actually NOT going to run it under the wrapper for now -if false && [ -x @prefix@/sbin/daemon_wrapper ]; then +if [ -z "$DEBUG" -a -x @prefix@/sbin/daemon_wrapper ]; then @prefix@/sbin/daemon_wrapper -i 30 -l @prefix@/log/mfrisbeed_wrapper.log \ @prefix@/sbin/mfrisbeed -d $args else