3.reportboot-subboss.sh.in 1.28 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 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
#!/bin/sh

# PROVIDE: reportboot_daemon
# REQUIRE: DAEMON ntpd
# BEFORE: testbed
# KEYWORD: shutdown

. /etc/rc.subr

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

case "$1" in
start|faststart|quietstart|onestart|forcestart)
    ;;
restart|fastrestart|quietrestart|onerestart|forcerestart)
    if [ -f /var/run/reportboot_daemon.pid ]; then
	kill `cat /var/run/reportboot_daemon.pid` >/dev/null 2>&1
	rm -f /var/run/reportboot_daemon.pid
    fi
    ;;
stop|faststop|quietstop|onestop|forcestop)
    echo -n ' reportboot_daemon'
    if [ -f /var/run/reportboot_daemon.pid ]; then
	kill `cat /var/run/reportboot_daemon.pid` >/dev/null 2>&1
	rm -f /var/run/reportboot_daemon.pid
    fi
    exit 0
    ;;
*)
    echo "Usage: $0 {start|stop|restart}" >&2
    exit 1
    ;;
esac

echo -n " reportboot_daemon"
rm -f /var/run/reportboot_daemon.pid

if [ -x @prefix@/sbin/daemon_wrapper ]; then
    @prefix@/sbin/daemon_wrapper -i 30 -l @prefix@/log/reportboot_daemon.log \
     -p /var/run/reportboot_daemon.pid @prefix@/sbin/reportboot_daemon -f
else
    @prefix@/sbin/reportboot_daemon
fi

exit $?