Commit 5727032b authored by Mike Hibler's avatar Mike Hibler

Allow debug and daemonize at the same time with -D flag.

And add DEBUG setting in rc.d startup scripts. This is something we had been
doing on subbosses with a hack, but I kept overwriting the hack!
parent 253f18e2
/*
* 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;
}
/*
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment