File: rc.watchdog.redhat

package info (click to toggle)
watchdog 5.2.6-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 780 kB
  • ctags: 690
  • sloc: ansic: 6,236; sh: 675; makefile: 74
file content (77 lines) | stat: -rw-r--r-- 2,323 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#! /bin/sh
#
# chkconfig: 12345 02 98
# description: A software watchdog
#
# rc file author: Marc Merlin <marcsoft@merlins.org>
#                 Henning P. Schmiedehausen <hps@tanstaafl.de>

# Note that even though chkconfig says that this should be run at runlevel 1,
# RH by default won't do this, so the RPM applies an ugly patch to 
# /etc/rc.d/init.d/single so that if you go from RL 3 to RL 1, watchdog is
# restarted anyway (if it's not, it can cause the kernel to reboot your machine
# depending on whether your kernel was compiled with CONFIG_WATCHDOG_NOWAYOUT)
#
# I have filed a bug with RH about this, and I hope they will change their
# single script to allow for other scripts to be run in RL 1.

# 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

# See how we were called.
case "$1" in
  start)
	echo -n "Starting software watchdog: "
	# For some people it is a module, for others not. We force it because
	# for kernels < 2.1, we need kerneld, and it's not running yet.

	modprobe softdog &>/dev/null
	modprobe pcwd &>/dev/null
	modprobe acquirewdt &>/dev/null

	if [ "${VERBOSE}"="yes" ]; then
	    daemon watchdog -v
	else
	    daemon watchdog
        fi
	echo
	touch /var/lock/subsys/watchdog
	;;
  stop)
	echo -n "Stopping software watchdog: "
	killproc watchdog
        # If you compiled your kernel with CONFIG_WATCHDOG_NOWAYOUT, you may
        # not want  to remove the module  as sometimes /etc/rc.d/init.d/halt
        # will hang on umounting some remote nfs partition or for some other
        # reason, and you may then want the kernel to reboot by itself.
        # However, this means that if you stop watchdog, your system has one
        # minute to reboot cleanly, or it will be rebooted by the kernel. If
        # this behavior  isn't what you  want, just uncomment  the following
        # lines
	#rmmod softdog &>/dev/null
	#rmmod pcwd &>/dev/null
	#rmmod acquirewdt &>/dev/null
	echo
	rm -f /var/lock/subsys/watchdog
	;;
  status)
	status watchdog
	;;
  restart|reload)
	/etc/rc.d/init.d/watchdog stop
	/etc/rc.d/init.d/watchdog start
	;;
  *)
	echo "Usage: watchdog {start|stop|status|restart|reload}"
	exit 1
	;;
esac

exit 0