Commit | Line | Data |
---|---|---|
9d3a4132 SE |
1 | #! /bin/sh |
2 | # /etc/init.d/secnet | |
3 | # | |
4 | # skeleton example file to build /etc/init.d/ scripts. | |
5 | # This file should be used to construct scripts for /etc/init.d. | |
6 | # | |
7 | # Written by Miquel van Smoorenburg <miquels@cistron.nl>. | |
8 | # Modified for Debian GNU/Linux | |
9 | # by Ian Murdock <imurdock@gnu.ai.mit.edu>. | |
10 | # | |
11 | # Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl | |
12 | # | |
13 | ||
828a43d1 RK |
14 | ### BEGIN INIT INFO |
15 | # Provides: secnet | |
f2376399 IJ |
16 | # Required-Start: $network $local_fs $remote_fs |
17 | # Required-Stop: $network $local_fs $remote_fs | |
828a43d1 RK |
18 | # Default-Start: 2 3 4 5 |
19 | # Default-Stop: 0 1 6 | |
20 | # Short-Description: Start and stop secnet | |
21 | # Description: secnet is a VPN server. | |
22 | ### END INIT INFO | |
23 | ||
9d3a4132 SE |
24 | set -e |
25 | ||
26 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
8dea8d37 | 27 | DAEMON=/usr/sbin/secnet |
9d3a4132 | 28 | NAME=secnet |
8dea8d37 | 29 | DESC="VPN server" |
9d3a4132 SE |
30 | |
31 | test -f $DAEMON || exit 0 | |
32 | test -f /etc/secnet/secnet.conf || exit 0 | |
ca58ee48 | 33 | test -f /etc/default/secnet && . /etc/default/secnet |
9d3a4132 | 34 | |
ca58ee48 | 35 | [ "X$RUN_SECNET" = "Xyes" ] || exit 0 |
9d3a4132 SE |
36 | |
37 | case "$1" in | |
38 | start) | |
39 | echo -n "Starting $DESC: " | |
40 | start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ | |
41 | --exec $DAEMON | |
42 | echo "$NAME." | |
43 | ;; | |
44 | stop) | |
45 | echo -n "Stopping $DESC: " | |
4f5e39ec SE |
46 | start-stop-daemon --stop --quiet --oknodo --pidfile \ |
47 | /var/run/$NAME.pid --exec $DAEMON | |
9d3a4132 SE |
48 | echo "$NAME." |
49 | ;; | |
50 | #reload) | |
51 | # | |
52 | # If the daemon can reload its config files on the fly | |
53 | # for example by sending it SIGHUP, do it here. | |
54 | # | |
55 | # If the daemon responds to changes in its config file | |
56 | # directly anyway, make this a do-nothing entry. | |
57 | # | |
58 | # echo "Reloading $DESC configuration files." | |
59 | # start-stop-daemon --stop --signal 1 --quiet --pidfile \ | |
60 | # /var/run/$NAME.pid --exec $DAEMON | |
61 | #;; | |
62 | restart|force-reload) | |
63 | # | |
64 | # If the "reload" option is implemented, move the "force-reload" | |
65 | # option to the "reload" entry above. If not, "force-reload" is | |
66 | # just the same as "restart". | |
67 | # | |
68 | echo -n "Restarting $DESC: " | |
69 | start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ | |
70 | --exec $DAEMON | |
71 | sleep 1 | |
72 | start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ | |
73 | --exec $DAEMON | |
74 | echo "$NAME." | |
75 | ;; | |
76 | *) | |
77 | N=/etc/init.d/$NAME | |
78 | # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 | |
79 | echo "Usage: $N {start|stop|restart|force-reload}" >&2 | |
80 | exit 1 | |
81 | ;; | |
82 | esac | |
83 | ||
84 | exit 0 |