1 #! /bin/sh |
|
2 # |
|
3 # skeleton example file to build /etc/init.d/ scripts. |
|
4 # This file should be used to construct scripts for /etc/init.d. |
|
5 # |
|
6 # Written by Miquel van Smoorenburg <miquels@cistron.nl>. |
|
7 # Modified for Debian |
|
8 # by Ian Murdock <imurdock@gnu.ai.mit.edu>. |
|
9 # |
|
10 # Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl |
|
11 # |
|
12 |
|
13 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
|
14 DAEMON=/usr/sbin/nagios-plugin-avwebgate |
|
15 NAME=nagios-plugin-avwebgate |
|
16 DESC=nagios-plugin-avwebgate |
|
17 |
|
18 test -x $DAEMON || exit 0 |
|
19 |
|
20 # Include nagios-plugin-avwebgate defaults if available |
|
21 if [ -f /etc/default/nagios-plugin-avwebgate ] ; then |
|
22 . /etc/default/nagios-plugin-avwebgate |
|
23 fi |
|
24 |
|
25 set -e |
|
26 |
|
27 case "$1" in |
|
28 start) |
|
29 echo -n "Starting $DESC: " |
|
30 start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ |
|
31 --exec $DAEMON -- $DAEMON_OPTS |
|
32 echo "$NAME." |
|
33 ;; |
|
34 stop) |
|
35 echo -n "Stopping $DESC: " |
|
36 start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ |
|
37 --exec $DAEMON |
|
38 echo "$NAME." |
|
39 ;; |
|
40 #reload) |
|
41 # |
|
42 # If the daemon can reload its config files on the fly |
|
43 # for example by sending it SIGHUP, do it here. |
|
44 # |
|
45 # If the daemon responds to changes in its config file |
|
46 # directly anyway, make this a do-nothing entry. |
|
47 # |
|
48 # echo "Reloading $DESC configuration files." |
|
49 # start-stop-daemon --stop --signal 1 --quiet --pidfile \ |
|
50 # /var/run/$NAME.pid --exec $DAEMON |
|
51 #;; |
|
52 force-reload) |
|
53 # |
|
54 # If the "reload" option is implemented, move the "force-reload" |
|
55 # option to the "reload" entry above. If not, "force-reload" is |
|
56 # just the same as "restart" except that it does nothing if the |
|
57 # daemon isn't already running. |
|
58 # check wether $DAEMON is running. If so, restart |
|
59 start-stop-daemon --stop --test --quiet --pidfile \ |
|
60 /var/run/$NAME.pid --exec $DAEMON \ |
|
61 && $0 restart \ |
|
62 || exit 0 |
|
63 ;; |
|
64 restart) |
|
65 echo -n "Restarting $DESC: " |
|
66 start-stop-daemon --stop --quiet --pidfile \ |
|
67 /var/run/$NAME.pid --exec $DAEMON |
|
68 sleep 1 |
|
69 start-stop-daemon --start --quiet --pidfile \ |
|
70 /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS |
|
71 echo "$NAME." |
|
72 ;; |
|
73 *) |
|
74 N=/etc/init.d/$NAME |
|
75 # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 |
|
76 echo "Usage: $N {start|stop|restart|force-reload}" >&2 |
|
77 exit 1 |
|
78 ;; |
|
79 esac |
|
80 |
|
81 exit 0 |
|