]> TLD Linux GIT Repositories - packages/openvpn.git/commitdiff
- start/stop/reload each daemon separately
authorMarcin Krol <hawk@tld-linux.org>
Tue, 3 Nov 2020 01:16:57 +0000 (02:16 +0100)
committerMarcin Krol <hawk@tld-linux.org>
Tue, 3 Nov 2020 01:16:57 +0000 (02:16 +0100)
openvpn.init

index fbd1851e5291eda38bccef9e07cdd38fc65539cd..ba4f5891f9a7cf73205aafb25733b6ee74d582d5 100755 (executable)
@@ -48,12 +48,6 @@ tunlsup() {
 }
 
 start() {
-       # Check if the service is already running?
-       if tunlsup; then
-               msg_already_running "OpenVPN"
-               return
-       fi
-
        msg_starting "OpenVPN"; started
        for tun in $TUNNELS; do
                config="/etc/openvpn/$tun.conf"
@@ -62,12 +56,8 @@ start() {
                        fail
                        RET=1
                else
-                       show "Starting OpenVPN tunnel %s" "$tun"
-                       if tunlup $tun; then
-                               started
-                               continue
-                       fi
-
+                       tunlup $tun && continue
+                       show "Starting OpenVPN tunnel %s" "$tun"; busy
                        daemon --pidfile /var/run/openvpn/$tun.pid /usr/sbin/openvpn --daemon --writepid /var/run/openvpn/$tun.pid \
                                --config $config --cd /etc/openvpn ${OPENVPN_OPT}
                        RET=$?
@@ -78,12 +68,6 @@ start() {
 }
 
 stop() {
-       if ! tunlsup; then
-               msg_not_running "OpenVPN"
-               return
-       fi
-
-       # Stop daemons.
        msg_stopping "OpenVPN"; started
        for tun in $TUNNELS; do
                pidfile=/var/run/openvpn/$tun.pid
@@ -91,6 +75,7 @@ stop() {
                pid=`cat "$pidfile"`
                show "Stopping OpenVPN tunnel %s" "$tun"; busy
                killproc --pidfile openvpn/$tun.pid || err=1
+               rm -f $pidfile
        done
        rm -f /var/lock/subsys/openvpn >/dev/null 2>&1
 }