3.mfrisbeed.sh.in 2.36 KB
Newer Older
1 2 3
#!/bin/sh

# PROVIDE: mfrisbeed
Mike Hibler's avatar
Mike Hibler committed
4
# REQUIRE: DAEMON ntpd mysql
5 6 7 8
# BEFORE: testbed
# KEYWORD: shutdown

#
9 10 11 12 13 14 15
# Set to run with debugging enabled.
#
#DEBUG=
DEBUG=yes

#
# Start up the frisbee master server on boss.
16 17 18 19 20 21 22 23 24 25 26 27 28
# We run it under the daemon wrapper if available so that it will get
# automatically restarted.
#

. /etc/rc.subr

bindir=@prefix@/sbin
if [ ! -x $bindir/mfrisbeed ]; then
    echo "*** mfrisbeed.sh: $bindir/mfrisbeed not installed"
    exit 1
fi

case "$1" in
29
start|faststart|quietstart|onestart|forcestart)
30
    ;;
31
restart|fastrestart|quietrestart|onerestart|forcerestart)
32 33 34 35 36 37 38 39 40
    if [ -f /var/run/mfrisbeed_wrapper.pid ]; then
	kill `cat /var/run/mfrisbeed_wrapper.pid` >/dev/null 2>&1
	rm -f /var/run/mfrisbeed_wrapper.pid
    fi
    if [ -f /var/run/mfrisbeed.pid ]; then
	kill `cat /var/run/mfrisbeed.pid` >/dev/null 2>&1
	rm -f /var/run/mfrisbeed.pid
    fi
    ;;
41
stop|faststop|quietstop|onestop|forcestop)
42 43 44 45 46 47 48 49 50
    echo -n ' mfrisbeed'
    if [ -f /var/run/mfrisbeed_wrapper.pid ]; then
	kill `cat /var/run/mfrisbeed_wrapper.pid` >/dev/null 2>&1
	rm -f /var/run/mfrisbeed_wrapper.pid
    fi
    if [ -f /var/run/mfrisbeed.pid ]; then
	kill `cat /var/run/mfrisbeed.pid` >/dev/null 2>&1
	rm -f /var/run/mfrisbeed.pid
    fi
51
    rm -f /var/run/frisbeed-*.pid
52 53 54 55 56 57 58 59
    exit 0
    ;;
*)
    echo "Usage: $0 {start|stop|restart}" >&2
    exit 1
    ;;
esac

60 61 62 63 64 65 66 67 68 69 70 71 72 73
#
# See if the testbed is "shutdown"; The variable has three values.
#  0  - Testbed is enabled.
#  1  - Testbed is disabled.
# -1  - Testbed is coming back online, so start up daemons.
#
if [ -x @prefix@/sbin/setsitevar ]; then
    disabled=`@prefix@/sbin/setsitevar -c general/testbed_shutdown`
    if [ $disabled -gt 0 ]; then
	echo -n " mfrisbeed disabled"
	exit 0
    fi
fi

74
echo -n " mfrisbeed"
75
rm -f /var/run/frisbeed-*.pid
76

77
args="-C emulab -i @BOSSNODE_IP@"
78 79
# to allow broadcast, uncomment the following line
#args="$args -x ucast,mcast,bcast"
80 81 82 83
# if an inner elab, use outer boss as our parent
if [ -n "@OUTERBOSS_NODENAME@" ]; then
    args="$args -S @OUTERBOSS_NODENAME@"
fi
84 85 86 87
# see if we need to be an IGMP querier
if [ "@NEEDMCQUERIER@" = "1" ]; then
    args="$args -Q 30"
fi
88 89 90
if [ -n "$DEBUG" ]; then
   args="-ddD $args"
fi
91

92
if [ -z "$DEBUG" -a -x @prefix@/sbin/daemon_wrapper ]; then
93 94 95 96 97 98 99
    @prefix@/sbin/daemon_wrapper -i 30 -l @prefix@/log/mfrisbeed_wrapper.log \
	@prefix@/sbin/mfrisbeed -d $args
else
    @prefix@/sbin/mfrisbeed $args
fi

exit $?