watchdog/watchdog.init
Richard W.M. Jones ac9baefef0 - New upstream version 5.9 (RHBZ#645541).
- Package new wd_identify program.
- Drop old cleanup patch, most of it is now upstream.
- Add newer cleanup patch, sent upstream.
- Fix some problems with the initscript (RHBZ#523391).
- Add systemd service (file installed but not used) (RHBZ#661220).
2011-01-17 13:54:42 +00:00

92 lines
1.6 KiB
Bash

#! /bin/sh
#
# watchdog - a watchdog daemon
#
# chkconfig: - 27 46
# description: A watchdog daemon
#
# rc file author: Marc Merlin <marcsoft@merlins.org>
# Henning P. Schmiedehausen <hps@tanstaafl.de>
# Richard W.M. Jones <rjones@redhat.com>
# Source function library.
. /etc/rc.d/init.d/functions
[ -x /usr/sbin/watchdog -a -e /etc/watchdog.conf ] || exit 0
VERBOSE="no"
if [ -f /etc/sysconfig/watchdog ]; then
. /etc/sysconfig/watchdog
fi
RETVAL=0
prog=watchdog
pidfile=/var/run/watchdog.pid
lockfile=/var/lock/subsys/watchdog
start() {
echo -n $"Starting $prog: "
if [ -n "$(pidofproc $prog)" ]; then
echo -n $"$prog: already running"
echo_failure
echo
return 1
fi
if [ "$VERBOSE" = "yes" ]; then
daemon /usr/sbin/${prog} -v
else
daemon /usr/sbin/${prog}
fi
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $lockfile
[ $RETVAL -eq 0 ] && echo_success
[ $RETVAL -ne 0 ] && echo_failure
return $RETVAL
}
stop() {
echo -n "Stopping $prog: "
# We are forcing it to _only_ use -TERM as killproc could use
# -KILL which would result in BMC timer not being set properly
# and reboot the box.
killproc $prog -TERM
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile
return $RETVAL
}
restart() {
stop
sleep 6
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
restart
;;
condrestart)
if [ -f $lockfile ]; then
restart
fi
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|status|condrestart}"
exit 1
esac
exit $RETVAL