chiark / gitweb /
legal: Clean up credits for init script
[secnet.git] / debian / init
1 #! /bin/sh
2 # /etc/init.d/secnet
3 #
4 # This file is part of secnet.
5 # See LICENCE and CREDITS for full list of copyright holders.
6 # SPDX-License-Identifier: GPL-3.0-or-later
7 # There is NO WARRANTY.
8
9 ### BEGIN INIT INFO
10 # Provides:          secnet
11 # Required-Start:    $network $local_fs $remote_fs
12 # Required-Stop:     $network $local_fs $remote_fs
13 # Default-Start:     2 3 4 5
14 # Default-Stop:      0 1 6
15 # Short-Description: Start and stop secnet
16 # Description:       secnet is a VPN server.
17 ### END INIT INFO
18
19 set -e
20
21 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
22 DAEMON=/usr/sbin/secnet
23 NAME=secnet
24 DESC="VPN server"
25
26 test -f $DAEMON || exit 0
27
28 . /lib/lsb/init-functions
29
30 test -f /etc/secnet/secnet.conf || exit 0
31 test -f /etc/default/secnet && . /etc/default/secnet
32
33 [ "X$RUN_SECNET" = "Xyes" ] || exit 0
34
35 case "$1" in
36   start)
37         echo -n "Starting $DESC: "
38         start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
39                 --exec $DAEMON
40         echo "$NAME."
41         ;;
42   stop)
43         echo -n "Stopping $DESC: "
44         start-stop-daemon --stop --quiet --oknodo --pidfile \
45             /var/run/$NAME.pid --exec $DAEMON
46         echo "$NAME."
47         ;;
48   #reload)
49         #
50         #       If the daemon can reload its config files on the fly
51         #       for example by sending it SIGHUP, do it here.
52         #
53         #       If the daemon responds to changes in its config file
54         #       directly anyway, make this a do-nothing entry.
55         #
56         # echo "Reloading $DESC configuration files."
57         # start-stop-daemon --stop --signal 1 --quiet --pidfile \
58         #       /var/run/$NAME.pid --exec $DAEMON
59   #;;
60   restart|force-reload)
61         #
62         #       If the "reload" option is implemented, move the "force-reload"
63         #       option to the "reload" entry above. If not, "force-reload" is
64         #       just the same as "restart".
65         #
66         echo -n "Restarting $DESC: "
67         start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
68                 --exec $DAEMON
69         sleep 1
70         start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
71                 --exec $DAEMON
72         echo "$NAME."
73         ;;
74   *)
75         N=/etc/init.d/$NAME
76         # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
77         echo "Usage: $N {start|stop|restart|force-reload}" >&2
78         exit 1
79         ;;
80 esac
81
82 exit 0