I am using the following command to establish a reverse ssh tunnel with an ssh server
ssh firstname.lastname@example.org -R 5001:localhost:22
The server is rebooted every night and the tunnel is established automatically on reboot successfully every time.
What I need to do, is run a check, and if for some reason the tunnel is not established, I want to log it in a log file.
How can I reliably check if the tunnel is up or not?
Keep in mind that other ssh sessions might be active at the time, so I don't want the checking method to pick up any of those successful sessions. It has to check only the tunnel.