2012-05-15 15:14:33 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#/etc/init.d/watchdog: start watchdog daemon.
|
|
|
|
#based on debian/init of watchdog
|
|
|
|
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: watchdog
|
|
|
|
# Short-Description: Start software watchdog daemon
|
2012-09-16 10:17:17 +00:00
|
|
|
# Required-Start: $local_fs
|
|
|
|
# Required-Stop:
|
2012-05-15 15:14:33 +00:00
|
|
|
# Should-Start:
|
|
|
|
# Should-Stop:
|
2012-05-16 13:46:07 +00:00
|
|
|
# Default-Start: S
|
|
|
|
# Default-Stop:
|
2012-05-15 15:14:33 +00:00
|
|
|
### END INIT INFO
|
|
|
|
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
|
|
|
|
|
|
|
test -x /usr/sbin/watchdog || exit 0
|
|
|
|
|
|
|
|
# For configuration of the init script use the file
|
|
|
|
# /etc/default/watchdog, do not edit this init script.
|
|
|
|
|
|
|
|
# Set run_watchdog to 1 to start watchdog or 0 to disable it.
|
|
|
|
|
|
|
|
# Specify additional watchdog options here (see manpage).
|
|
|
|
watchdog_options=""
|
|
|
|
|
|
|
|
# Specify module to load
|
|
|
|
watchdog_module="none"
|
|
|
|
|
|
|
|
run_watchdog=1
|
|
|
|
|
|
|
|
[ -e /etc/default/watchdog ] && . /etc/default/watchdog
|
|
|
|
|
|
|
|
NAME=watchdog
|
|
|
|
|
|
|
|
DAEMON=/usr/sbin/watchdog
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
if [ $run_watchdog = 1 ]
|
|
|
|
then
|
|
|
|
# do we have to load a module?
|
|
|
|
[ ${watchdog_module:-none} != "none" ] && /sbin/modprobe $watchdog_module
|
|
|
|
|
|
|
|
# Unconditionally start watchdog daemon because we want to run it even
|
|
|
|
# if wd_keepalive wasn't running
|
|
|
|
echo "Starting watchdog daemon..."
|
|
|
|
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
|
|
|
|
--exec $DAEMON -- $watchdog_options
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
stop)
|
|
|
|
if [ $run_watchdog = 1 ]
|
|
|
|
then
|
|
|
|
echo "Stopping watchdog daemon..."
|
|
|
|
start-stop-daemon --stop -s 9 --quiet \
|
|
|
|
--pidfile /var/run/$NAME.pid
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
restart)
|
|
|
|
$0 force-reload
|
|
|
|
;;
|
|
|
|
|
|
|
|
force-reload)
|
|
|
|
if [ $run_watchdog = 0 ]; then exit 0; fi
|
|
|
|
echo "Restarting ${NAME}"
|
2012-09-16 10:17:17 +00:00
|
|
|
$0 stop
|
|
|
|
$0 start
|
2012-05-15 15:14:33 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "Usage: /etc/init.d/watchdog {start|stop|restart|force-reload}"
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|