summaryrefslogtreecommitdiff
path: root/system/watchdog/config/rc.watchdog
diff options
context:
space:
mode:
Diffstat (limited to 'system/watchdog/config/rc.watchdog')
-rw-r--r--system/watchdog/config/rc.watchdog43
1 files changed, 43 insertions, 0 deletions
diff --git a/system/watchdog/config/rc.watchdog b/system/watchdog/config/rc.watchdog
new file mode 100644
index 0000000000..7e07dff61f
--- /dev/null
+++ b/system/watchdog/config/rc.watchdog
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# /etc/rc.d/rc.watchdog
+#
+# Start/stop/restart the watchdog timer service.
+
+watchdog_start() {
+ if [ ! -e /dev/watchdog ]; then
+ echo "$0: No /dev/watchdog device node seems to exist on this system."
+ echo "$0: A kernel module probably needs to be loaded; please see:"
+ echo "$0: /usr/src/linux/Documentation/watchdog/watchdog-api.txt"
+ exit 0
+ fi
+ if [ -x /usr/sbin/watchdog -a -r /etc/watchdog.conf ]; then
+ echo "Starting the watchdog timer service: /usr/sbin/watchdog"
+ /usr/sbin/watchdog
+ fi
+}
+
+watchdog_stop() {
+ killall watchdog
+}
+
+watchdog_restart() {
+ watchdog_stop
+ sleep 10 # can take a while to die
+ watchdog_start
+}
+
+case "$1" in
+'start')
+ watchdog_start
+ ;;
+'stop')
+ watchdog_stop
+ ;;
+'restart')
+ watchdog_restart
+ ;;
+*)
+ echo $"Usage: $0 {start|stop|restart}"
+esac
+