diff options
-rwxr-xr-x | scripts/dmvpn-config.pl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/dmvpn-config.pl b/scripts/dmvpn-config.pl index 5052211..6fa180d 100755 --- a/scripts/dmvpn-config.pl +++ b/scripts/dmvpn-config.pl @@ -491,11 +491,35 @@ if ( is_vpn_running() ) { else { if ( !defined($update_interval) ) { vpn_exec( 'ipsec start >&/dev/null', 'start ipsec' ); + my $counter = 10; + while($counter > 0){ + if (-e "/var/run/charon.pid") { + vpn_exec( 'swanctl -q >&/dev/null', 'reload changes to swanctl.conf' ); + last; + } + $counter--; + sleep(1); + if($counter == 0){ + vpn_die("$vpn_cfg_err Ipsec is not running."); + } + } } else { vpn_exec( 'ipsec start --auto-update ' . $update_interval . ' >&/dev/null', 'start ipsec with auto-update $update_interval' ); + my $counter = 10; + while($counter > 0){ + if (-e "/var/run/charon.pid") { + vpn_exec( 'swanctl -q >&/dev/null', 'reload changes to swanctl.conf' ); + last; + } + $counter--; + sleep(1); + if($counter == 0){ + vpn_die("$vpn_cfg_err Ipsec is not running."); + } + } } } |