Created
January 15, 2013 10:52
-
-
Save grindars/4537867 to your computer and use it in GitHub Desktop.
watchdogd initscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/sysconfig/watchdogd | |
WATCHDOGD_OPTIONS="itusbwdt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# watchdogd Startup script for watchdogd | |
# | |
# chkconfig: 2345 12 88 | |
# description: Kiosk watchdog support daemon | |
### BEGIN INIT INFO | |
# Provides: $watchdogd | |
# Required-Start: $local_fs | |
# Required-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Kiosk watchdog support daemon | |
# Description: Kiosk watchdog support daemon | |
### END INIT INFO | |
# Source function library. | |
. /etc/init.d/functions | |
RETVAL=0 | |
PIDFILE=/var/run/watchdogd.pid | |
prog=watchdogd | |
exec=/usr/bin/watchdogd | |
lockfile=/var/lock/subsys/$prog | |
# Source config | |
if [ -f /etc/sysconfig/$prog ] ; then | |
. /etc/sysconfig/$prog | |
fi | |
start() { | |
21[ -x $exec ] || exit 5 | |
umask 077 | |
echo -n $"Starting watchdogd: " | |
daemon --pidfile="$PIDFILE" $exec -d -p "$PIDFILE" $WATCHDOGD_OPTIONS | |
RETVAL=$? | |
echo | |
[ $RETVAL -eq 0 ] && touch $lockfile | |
return $RETVAL | |
} | |
stop() { | |
echo -n $"Shutting down watchdogd: " | |
killproc -p "$PIDFILE" $exec | |
RETVAL=$? | |
echo | |
[ $RETVAL -eq 0 ] && rm -f $lockfile | |
return $RETVAL | |
} | |
rhstatus() { | |
status -p "$PIDFILE" -l $prog $exec | |
} | |
restart() { | |
stop | |
start | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
restart | |
;; | |
reload) | |
exit 3 | |
;; | |
force-reload) | |
restart | |
;; | |
status) | |
rhstatus | |
;; | |
condrestart|try-restart) | |
rhstatus >/dev/null 2>&1 || exit 0 | |
restart | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status}" | |
exit 3 | |
esac | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment