sanlock/wdmd.init

82 lines
1.7 KiB
Plaintext
Raw Normal View History

#!/bin/sh
### BEGIN INIT INFO
# Provides: wdmd
# Required-Start: $time $syslog
# Required-Stop: $syslog
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts and stops wdmd daemon
# Description: starts and stops wdmd daemon
### END INIT INFO
WDMD_BIN=/usr/sbin/wdmd
WDMD_PIDFILE=/var/run/wdmd/wdmd.pid
WDMDGROUP="sanlock"
WDMDOPTS="-G $WDMDGROUP"
test -x $WDMD_BIN || { echo "$WDMD_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
. /etc/rc.status
rc_reset
case "$1" in
start)
if [ ! -d /var/run/$prog ]; then
mkdir -p /var/run/$prog
fi
if [ -e $WDMD_PIDFILE ]; then
if checkproc $WDMD_BIN ; then
echo -n "wdmd is already running."
rc_status -v
exit
else
echo "Removing stale PID file $WDMD_PIDFILE."
rm -f $WDMD_PIDFILE
fi
fi
echo -n "Starting wdmd "
startproc $WDMD_BIN $WDMDOPTS
rc_status -v
;;
stop)
echo -n "Shutting down wdmd "
killproc -TERM $WDMD_BIN > /dev/null 2>&1
rm -f $WDMD_PIDFILE
rc_status -v
;;
try-restart)
$0 status >/dev/null && $0 restart
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
reload)
killproc -HUP $WDMD_BIN
rc_status -v
;;
status)
echo -n "Checking status of wdmd "
checkproc $WDMD_BIN
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|reload|status}"
rc_failed 2
rc_exit
;;
esac
rc_exit