Debian Codegraph @

tools/hotplug/Linux/init.d/xen-watchdog.in

raw
1 #! /bin/bash
2 #
3 # xen-watchdog
4 #
5 # chkconfig: 2345 21 79
6 # description: Run domain watchdog daemon
7 ### BEGIN INIT INFO
8 # Provides: xen-watchdog
9 # Required-Start: $syslog $remote_fs
10 # Should-Start: xend
11 # Required-Stop: $syslog $remote_fs
12 # Should-Stop: xend
13 # Default-Start: 2 3 5
14 # Default-Stop: 0 1 6
15 # Short-Description: Start/stop xen-watchdog
16 # Description: Run domain watchdog daemon.
17 ### END INIT INFO
18 #
19
20 . @XEN_SCRIPT_DIR@/hotplugpath.sh
21
22 xencommons_config=@CONFIG_DIR@/@CONFIG_LEAF_DIR@
23
24 test -f $xencommons_config/xencommons && . $xencommons_config/xencommons
25
26 test -n "$XENWATCHDOGD_ARGS" || XENWATCHDOGD_ARGS='30 15'
27 DAEMON=${sbindir}/xenwatchdogd
28 base=$(basename $DAEMON)
29
30 # Source function library.
31 if [ -e /etc/init.d/functions ] ; then
32 . /etc/init.d/functions
33 elif [ -e /lib/lsb/init-functions ] ; then
34 . /lib/lsb/init-functions
35 success () {
36 log_success_msg $*
37 }
38 failure () {
39 log_failure_msg $*
40 }
41 else
42 success () {
43 echo $*
44 }
45 failure () {
46 echo $*
47 }
48 fi
49
50 start() {
51 local r
52 echo -n $"Starting domain watchdog daemon: "
53
54 $DAEMON $XENWATCHDOGD_ARGS
55 r=$?
56 [ "$r" -eq 0 ] && success $"$base startup" || failure $"$base startup"
57 echo
58
59 return $r
60 }
61
62 stop() {
63 local r
64 echo -n $"Stopping domain watchdog daemon: "
65
66 killall -USR1 $base 2>/dev/null
67 r=$?
68 [ "$r" -eq 0 ] && success $"$base stop" || failure $"$base stop"
69 echo
70
71 return $r
72 }
73
74 case "$1" in
75 start)
76 start
77 ;;
78 stop)
79 stop
80 ;;
81 restart)
82 stop
83 start
84 ;;
85 status)
86 ;;
87 condrestart)
88 stop
89 start
90 ;;
91 *)
92 echo $"Usage: $0 {start|stop|status|restart|condrestart}"
93 exit 1
94 esac
95