| 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 | |
| 14 | set -e |
| 15 | |
| 16 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
| 17 | DAEMON=/usr/sbin/secnet |
| 18 | NAME=secnet |
| 19 | DESC="VPN server" |
| 20 | |
| 21 | test -f $DAEMON || exit 0 |
| 22 | test -f /etc/secnet/secnet.conf || exit 0 |
| 23 | |
| 24 | set -e |
| 25 | |
| 26 | case "$1" in |
| 27 | start) |
| 28 | echo -n "Starting $DESC: " |
| 29 | start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ |
| 30 | --exec $DAEMON |
| 31 | echo "$NAME." |
| 32 | ;; |
| 33 | stop) |
| 34 | echo -n "Stopping $DESC: " |
| 35 | start-stop-daemon --stop --quiet --oknodo --pidfile \ |
| 36 | /var/run/$NAME.pid --exec $DAEMON |
| 37 | echo "$NAME." |
| 38 | ;; |
| 39 | #reload) |
| 40 | # |
| 41 | # If the daemon can reload its config files on the fly |
| 42 | # for example by sending it SIGHUP, do it here. |
| 43 | # |
| 44 | # If the daemon responds to changes in its config file |
| 45 | # directly anyway, make this a do-nothing entry. |
| 46 | # |
| 47 | # echo "Reloading $DESC configuration files." |
| 48 | # start-stop-daemon --stop --signal 1 --quiet --pidfile \ |
| 49 | # /var/run/$NAME.pid --exec $DAEMON |
| 50 | #;; |
| 51 | restart|force-reload) |
| 52 | # |
| 53 | # If the "reload" option is implemented, move the "force-reload" |
| 54 | # option to the "reload" entry above. If not, "force-reload" is |
| 55 | # just the same as "restart". |
| 56 | # |
| 57 | echo -n "Restarting $DESC: " |
| 58 | start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ |
| 59 | --exec $DAEMON |
| 60 | sleep 1 |
| 61 | start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ |
| 62 | --exec $DAEMON |
| 63 | echo "$NAME." |
| 64 | ;; |
| 65 | *) |
| 66 | N=/etc/init.d/$NAME |
| 67 | # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 |
| 68 | echo "Usage: $N {start|stop|restart|force-reload}" >&2 |
| 69 | exit 1 |
| 70 | ;; |
| 71 | esac |
| 72 | |
| 73 | exit 0 |