diff options
Diffstat (limited to 'meta-networking/recipes-protocols/quagga/files/watchquagga.init')
-rw-r--r-- | meta-networking/recipes-protocols/quagga/files/watchquagga.init | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/quagga/files/watchquagga.init b/meta-networking/recipes-protocols/quagga/files/watchquagga.init new file mode 100644 index 000000000..5ddd94a3d --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/watchquagga.init | |||
@@ -0,0 +1,64 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | ### BEGIN INIT INFO | ||
4 | # Provides: watchquagga | ||
5 | # Required-Start: $local_fs $network $remote_fs $syslog | ||
6 | # Required-Stop: $local_fs $network $remote_fs $syslog | ||
7 | # Default-Start: 2 3 4 5 | ||
8 | # Default-Stop: 0 1 6 | ||
9 | # Short-Description: start and stop the Quagga watchdog | ||
10 | ### END INIT INFO | ||
11 | |||
12 | PATH=/bin:/usr/bin:/sbin:/usr/sbin | ||
13 | |||
14 | # Load configuration | ||
15 | test -f /etc/default/watchquagga && . /etc/default/watchquagga | ||
16 | |||
17 | # Check that there are daemons to be monitored. | ||
18 | [ -z "$watch_daemons" ] && exit 0 | ||
19 | |||
20 | pidfile="/var/run/quagga/watchquagga.pid" | ||
21 | |||
22 | case "$1" in | ||
23 | start) | ||
24 | echo -n "Starting quagga watchdog daemon: watchquagga" | ||
25 | start-stop-daemon --start \ | ||
26 | --pidfile $pidfile \ | ||
27 | --exec /usr/sbin/watchquagga \ | ||
28 | -- -d $watch_options $watch_daemons | ||
29 | echo "." | ||
30 | ;; | ||
31 | |||
32 | stop) | ||
33 | echo -n "Stopping quagga watchdog daemon: watchquagga" | ||
34 | start-stop-daemon --stop --quiet \ | ||
35 | --pidfile $pidfile | ||
36 | echo "." | ||
37 | ;; | ||
38 | |||
39 | status) | ||
40 | echo -n "watchquagga " | ||
41 | res=1 | ||
42 | [ -e $pidfile ] && kill -0 `cat $pidfile` 2> /dev/null | ||
43 | if [ $? -eq 0 ]; then | ||
44 | echo "(pid `cat $pidfile`) is running..." | ||
45 | res=0 | ||
46 | else | ||
47 | echo "is stopped..." | ||
48 | fi | ||
49 | exit $res | ||
50 | ;; | ||
51 | |||
52 | restart|force-reload) | ||
53 | $0 stop $2 | ||
54 | sleep 1 | ||
55 | $0 start $2 | ||
56 | ;; | ||
57 | |||
58 | *) | ||
59 | echo "Usage: /etc/init.d/watchquagga {start|stop|restart|force-reload}" | ||
60 | exit 1 | ||
61 | ;; | ||
62 | esac | ||
63 | |||
64 | exit 0 | ||