blob: a02ab1a7af5ed9776ee9f7af778037e478f42182 (
plain)
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
|
#!/bin/sh
### BEGIN INIT INFO
# Provides: softdog-mon
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Advanced Power Management daemon
### END INIT INFO
# Source function library.
. /etc/init.d/functions
if [ -r /etc/default/softdog-mon ] ; then
. /etc/default/softdog-mon
fi
LOG="logger -s -t 'softdog-mon' -p"
PATH=/bin:/usr/bin:/sbin:/usr/sbin
[ -f /etc/default/rcS ] && . /etc/default/rcS
[ -f /etc/default/softdog-mon ] && . /etc/default/softdog-mon
if ! [[ -c $WATCHDOGDEV ]] ; then
$LOG daemon.err "ERROR: device \"$WATCHDOGDEV\" was not found"
exit 1
fi
if [[ -z $TIMEOUT ]] ; then
$LOG daemon.err "ERROR: timeout \"$TIMEOUT\" was not found"
exit 1
fi
# Use NICE of zero if not set.
: ${NICE:=0}
case "$1" in
start)
echo -n "Starting softdog monitor daemon: "
/usr/sbin/start-stop-daemon -N $NICE \
-S -x /usr/sbin/softdog-mon -- $WATCHDOGDEV $TIMEOUT
if [ $? = 0 ]; then
echo "softdog-mon."
else
echo "(failed.)"
fi
;;
stop)
echo -n "Stopping softdog monitor daemon: "
/usr/sbin/start-stop-daemon -K \
-x /usr/sbin/softdog-mon
echo "softdog-mon."
;;
status)
status /usr/sbin/softdog-mon;
exit $?
;;
restart|force-reload)
$0 stop
$0 start
exit
;;
*)
echo "Usage: /etc/init.d/softdog-mon {start|stop|status|restart|force-reload}"
exit 1
;;
esac
exit 0
|