Say I have a SOCKS connection at local (established by ssh -D8888
). I use this to do many things, like bypass the internet censorship.
But sometimes the ssh would unexpectedly broken. Then the socks is down.
Is there anything that I can used to check whether the local SOCKS proxy is still alive?
Thanks,
Best Answer
You can test the availability of a socks proxy by trying to load a website through the tunnel.
In the above command,
curl
will be silent, unless an error occurs. You can wrap this command in a for loop within a script. The return value ofcurl
is zero if the socks proxy is alive (andgoogle.com
is not down).