What's new

Cron task VPN reconnect based on ping?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

primitivo

Senior Member
I am using Astrill VPN (via their applet) with private IP and for some reason my ISP seems to have different latencies to the same data center. It would not bother me much if the difference would be negligible, but I am getting as low as 117ms and as high as 220ms. Once the connection with VPN is established, it keeps the same latency for few days until my ISP change my WAN IP or I will reboot the router or there would be a random VPN disconnection.

So for me I would obviously prefer to keep the best latency, which is why I wonder if it is possible to setup a task which will check ping to Astrill's DNS server upon establishing VPN connection and if it is above let's say 130ms, it will reconnect VPN every 30-60 seconds?

I know how should the script look like for 6AM VPN restart:

cru a ovpnrestart '0 6 * * * killall -HUP openvpn'
echo "cru a ovpnrestart '0 6 * * * killall -HUP openvpn'" >> /jffs/scripts/init-start

But I wonder if it is possible to extend it for ping check upon startup and reconnect it based on the ping results?
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top