diff options
-rwxr-xr-x | meta-networking/recipes-support/openvpn/openvpn/openvpn | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/meta-networking/recipes-support/openvpn/openvpn/openvpn b/meta-networking/recipes-support/openvpn/openvpn/openvpn index a3cd6a2f4..e5af4b230 100755 --- a/meta-networking/recipes-support/openvpn/openvpn/openvpn +++ b/meta-networking/recipes-support/openvpn/openvpn/openvpn | |||
@@ -4,6 +4,7 @@ | |||
4 | # <rob@mars.org>, edited by iwj and cs | 4 | # <rob@mars.org>, edited by iwj and cs |
5 | # Modified for openvpn by Alberto Gonzalez Iniesta <agi@agi.as> | 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> | 6 | # Modified for restarting / starting / stopping single tunnels by Richard Mueller <mueller@teamix.net> |
7 | # Modified for respecting pid file on service start by Fabian Klemp <fabian.klemp@axino-group.com> | ||
7 | 8 | ||
8 | test $DEBIAN_SCRIPT_DEBUG && set -v -x | 9 | test $DEBIAN_SCRIPT_DEBUG && set -v -x |
9 | 10 | ||
@@ -14,10 +15,17 @@ test -d $CONFIG_DIR || exit 0 | |||
14 | 15 | ||
15 | start_vpn () { | 16 | start_vpn () { |
16 | modprobe tun >/dev/null 2>&1 || true | 17 | modprobe tun >/dev/null 2>&1 || true |
17 | $DAEMON --daemon --writepid /var/run/openvpn.$NAME.pid \ | 18 | start-stop-daemon --start --quiet --pidfile /var/run/openvpn.$NAME.pid \ |
18 | --config $CONFIG_DIR/$NAME.conf --cd $CONFIG_DIR || echo -n " FAILED->" | 19 | --exec $DAEMON -- \ |
20 | --daemon --writepid /var/run/openvpn.$NAME.pid \ | ||
21 | --config $CONFIG_DIR/$NAME.conf --cd $CONFIG_DIR || rc="$?" | ||
22 | case $rc in | ||
23 | 1) echo -n " ALREADY STARTED->";; | ||
24 | 3) echo -n " FAILED->";; | ||
25 | esac | ||
19 | echo -n " $NAME" | 26 | echo -n " $NAME" |
20 | } | 27 | } |
28 | |||
21 | stop_vpn () { | 29 | stop_vpn () { |
22 | kill `cat $PIDFILE` || true | 30 | kill `cat $PIDFILE` || true |
23 | rm $PIDFILE | 31 | rm $PIDFILE |