3da046d2c25bb15f61ab4c3c5c2bbb6688dc64c1
[l2tpns.git] / debian / init.d
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides:          l2tpns
4 # Required-Start:    $remote_fs $syslog
5 # Required-Stop:     $remote_fs $syslog
6 # Default-Start:     2 3 4 5
7 # Default-Stop:      0 1 6
8 ### END INIT INFO
9 #
10 # l2tpns        Based on skeleton example file.
11 #
12 #               Written by Miquel van Smoorenburg <miquels@cistron.nl>.
13 #               Modified for Debian GNU/Linux
14 #               by Ian Murdock <imurdock@gnu.ai.mit.edu>.
15 #
16
17 PATH=/sbin:/bin:/usr/sbin:/usr/bin
18 DAEMON=/usr/sbin/l2tpns
19 NAME=l2tpns
20 DESC=l2tpns
21 ARGS="-d"
22
23 test -f $DAEMON || exit 0
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 -- $ARGS
32         echo "$NAME."
33         ;;
34   stop)
35         echo -n "Stopping $DESC: "
36         start-stop-daemon --oknodo --stop --signal 3 --quiet \
37                 --pidfile /var/run/$NAME.pid --exec $DAEMON -- $ARGS
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 -- $ARGS
51         ;;
52   restart|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".
57         #
58         echo -n "Restarting $DESC: "
59         start-stop-daemon --stop --quiet --pidfile \
60                 /var/run/$NAME.pid --exec $DAEMON -- $ARGS
61         sleep 5
62         start-stop-daemon --start --quiet --pidfile \
63                 /var/run/$NAME.pid --exec $DAEMON -- $ARGS
64         echo "$NAME."
65         ;;
66   *)
67         N=/etc/init.d/$NAME
68         # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
69         echo "Usage: $N {start|stop|restart|force-reload}" >&2
70         exit 1
71         ;;
72 esac
73
74 exit 0