3 # Original version by Robert Leslie
4 # <rob@mars.org>, edited by iwj and cs
5 # Modified for openvpn by Alberto Gonzalez Iniesta <agi@agi.as>
6 # Modified for restarting / starting / stopping single tunnels by Richard Mueller <mueller@teamix.net>
8 test $DEBIAN_SCRIPT_DEBUG && set -v -x
10 DAEMON
=/usr
/sbin
/openvpn
11 CONFIG_DIR
=/etc
/openvpn
12 test -x $DAEMON ||
exit 0
13 test -d $CONFIG_DIR ||
exit 0
16 $DAEMON --daemon --writepid /var
/run
/openvpn.
$NAME.pid \
17 --config $CONFIG_DIR/$NAME.conf
--cd $CONFIG_DIR ||
echo -n " FAILED->"
21 kill `cat $PIDFILE` || true
27 echo -n "Starting openvpn:"
30 for CONFIG
in `cd $CONFIG_DIR; ls *.conf 2> /dev/null`; do
35 if test -e $CONFIG_DIR/$2.conf
; then
39 echo -n " No such VPN: $2"
46 echo -n "Stopping openvpn:"
49 for PIDFILE
in `ls /var/run/openvpn.*.pid 2> /dev/null`; do
50 NAME
=`echo $PIDFILE | cut -c18-`
56 if test -e /var
/run
/openvpn.
$2.pid
; then
57 PIDFILE
=`ls /var/run/openvpn.$2.pid 2> /dev/null`
58 NAME
=`echo $PIDFILE | cut -c18-`
63 echo -n " No such VPN: $2"
68 # We only 'reload' for running VPNs. New ones will only start with 'start' or 'restart'.
70 echo -n "Reloading openvpn:"
71 for PIDFILE
in `ls /var/run/openvpn.*.pid 2> /dev/null`; do
72 NAME
=`echo $PIDFILE | cut -c18-`
74 # If openvpn if running under a different user than root we'll need to restart
75 if egrep '^( |\t)*user' $CONFIG_DIR/$NAME.conf
> /dev
/null
2>&1 ; then
81 kill -HUP `cat $PIDFILE` || true
82 # start-stop-daemon --stop --signal HUP --quiet --oknodo \
83 # --exec $DAEMON --pidfile $PIDFILE
96 echo "Usage: $0 {start|stop|reload|restart|force-reload}" >&2
103 # vim:set ai et sts=2 sw=2 tw=0:
This page took 0.057707 seconds and 5 git commands to generate.