Blame SOURCES/watchdog.init

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