0

I'm using autossh to connect to a reverse SSH tunnel. I run it from startup.

However, I was facing problems in that the tunnel sometimes goes down.

I created a script which checks if the tunnel is actually working , and if not do other stuff like restart the modem.

The only way I seem to be able to check if the tunnel is working is by using the autossh command again and checking the reply.

autossh -M 0 -N -q -o ServerAliveInterval=20 -o ServerAliveCountMax=3 HMzg8fYGfW11oJ7Jl6BCTT2lYrB@fw1.sshreach.me -i id_rsa -R 13212:localhost:22 -v

I just noticed tho that every time I use this autossh command, it starts a new auto process. There are so many autossh processes running now. This is obviously not good.

There are two questions :

1) Is there a better way to verify if my tunnel is working without using the autossh command again? (I couldn't find another way)

2) The other option I suppose is to kill the processes in my script which are not used and just have the one autossh process. However, How do I find the pid of a process if there are many of them with the name autossh?

Thanks in advance

0 Answers0