Hello community,
my vpn service provider does not support keep alive in their setting, so i need another way to check if vpn client is connected and auto reconnect if it is disconnected, a sh script should do the job.
The scipt should do something like this:
nvram get vpn_client1_state # Check VPN client status
if response code is not 2 then # if vpn client is not connected then
service stop_vpnclient1 # stop vpn client
sleep 3s # pause 3 seconds
service start_vpnclient1 # start/connect vpn client
loop these commands for vpnclient[1-5]
My router is AX56U and can set up to 5 vpn clients, the status codes are:
2=connected
1= connecting
0=disconnected
-1= failed to connect
I dont know how to write sh script and hope someone can help me to make a working script, so that i can shedule it with crontab. Many thanks.
my vpn service provider does not support keep alive in their setting, so i need another way to check if vpn client is connected and auto reconnect if it is disconnected, a sh script should do the job.
The scipt should do something like this:
nvram get vpn_client1_state # Check VPN client status
if response code is not 2 then # if vpn client is not connected then
service stop_vpnclient1 # stop vpn client
sleep 3s # pause 3 seconds
service start_vpnclient1 # start/connect vpn client
loop these commands for vpnclient[1-5]
My router is AX56U and can set up to 5 vpn clients, the status codes are:
2=connected
1= connecting
0=disconnected
-1= failed to connect
I dont know how to write sh script and hope someone can help me to make a working script, so that i can shedule it with crontab. Many thanks.
Last edited: