2021年1月4日星期一

Ping google.com to see if vpn-server is up, if down, reconnect to another one

I am using a VPN server on a vps. The VPN service I use can of course go down for a few minutes or maybe even hours by accident or whatever. If it happens, I would like to quickly reconnect to another vpn-server with the command "vpnapp reconnect".

Does anyone know how to do a bash script I will run every minute via cronjob that:

  1. Pings google.com

2A) If it can be reached, do nothing

2B) If it cannot be reached - which would mean the vpn server is down/not working - enter terminal command "vpnapp reconnect" which will make the vpn application reconnect to next available server they offer.

Would be so thankful if anyone could help me. I have ZERO programming knowledge. To me this is pure science.

Thanks in advance. Oski

https://stackoverflow.com/questions/65571737/ping-google-com-to-see-if-vpn-server-is-up-if-down-reconnect-to-another-one January 05, 2021 at 08:36AM

没有评论:

发表评论