3.mfrisbeed.sh.in 2.5 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
# It is expected that the boss mfrisbeed will use config_emulab which
# queries the database directly for configuration parameters.
#
19 20 21 22 23 24 25 26 27 28 29 30 31
# 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
32
start|faststart|quietstart|onestart|forcestart)
33
    ;;
34
restart|fastrestart|quietrestart|onerestart|forcerestart)
35 36 37 38 39 40 41 42 43
    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
    ;;
44
stop|faststop|quietstop|onestop|forcestop)
45 46 47 48 49 50 51 52 53
    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
54
    rm -f /var/run/frisbeed-*.pid
55 56 57 58 59 60 61 62
    exit 0
    ;;
*)
    echo "Usage: $0 {start|stop|restart}" >&2
    exit 1
    ;;
esac

63 64 65 66 67 68 69 70 71 72 73 74 75 76
#
# 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

77
echo -n " mfrisbeed"
78
rm -f /var/run/frisbeed-*.pid
79

80
args="-C emulab -i @BOSSNODE_IP@"
81 82
# to allow broadcast, uncomment the following line
#args="$args -x ucast,mcast,bcast"
83

84 85 86
# see if we need to be an IGMP querier
if [ "@NEEDMCQUERIER@" = "1" ]; then
    args="$args -Q 30"
87 88 89 90
    # XXX it is a v2 querier
    sysctl net.inet.igmp.default_version=2
    sysctl net.inet.igmp.legacysupp=1
    sysctl net.inet.igmp.v2enable=1
91
fi
92 93 94
if [ -n "$DEBUG" ]; then
   args="-ddD $args"
fi
95

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

exit $?