From 281b377ae0d2d84bdfd3e8ee0226cababfe0c41b Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Tue, 3 Nov 2020 02:16:57 +0100 Subject: [PATCH] - start/stop/reload each daemon separately --- openvpn.init | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/openvpn.init b/openvpn.init index fbd1851..ba4f589 100755 --- a/openvpn.init +++ b/openvpn.init @@ -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 } -- 2.46.0