3.mfrisbeed-subboss.sh.in 2.05 KB
Newer Older
1 2 3
#!/bin/sh

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

8 9 10 11 12 13 14 15
#
# Base multicast address.
# By default for the null config we use, it is "239.192.1".
# Subbosses on the same network should use different values; e.g., 239.193.1.
#
#MCBASEADDR=""
MCBASEADDR="239.192.1"

16 17 18 19 20 21
#
# Set to run with debugging enabled.
#
#DEBUG=
DEBUG=yes

22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
#
# 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.
# We cannot use "tmcc role" because tmcc doesn't exist/work on real boss.
# So we just do our own script right now.
#
# 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
start|faststart)
    ;;
restart)
    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
    ;;
stop)
    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
    rm -f /var/run/frisbeed-*.pid
    exit 0
    ;;
*)
    echo "Usage: $0 {start|stop|restart}" >&2
    exit 1
    ;;
esac

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

75
args="-C null -S @BOSSNODE_IP@ -I /z/image_cache -A -M -R"
76 77 78
if [ -n "$MCBASEADDR" ]; then
    args="$args -O mcaddr=$MCBASEADDR"
fi
79 80 81 82 83
if [ -n "$DEBUG" ]; then
   args="-ddD $args"
fi

if [ -z "$DEBUG" -a -x @prefix@/sbin/daemon_wrapper ]; then
84 85 86 87 88 89 90
    @prefix@/sbin/daemon_wrapper -i 30 -l @prefix@/log/mfrisbeed_wrapper.log \
	@prefix@/sbin/mfrisbeed -d $args
else
    @prefix@/sbin/mfrisbeed $args
fi

exit $?