title: Knowing if a remote port forward was successful?
body: <p>I am trying to setup some reverse ssh tunnels so I can access my home network by bouncing off some server with a public IP.</p>
  
  <p>When I run this command:
  ssh -R :[port_XX]:localhost:22 some_user@my_server</p>
  
  <p>Even if "port_XX" is in use, it will still make a successful ssh connection to "my_server".</p>
  
  <p>If I am running this command directly, I can see the problem when it gives me a warning:
  "Warning: remote port forwarding failed for listen port [port_XX]"</p>
  
  <p>However, I am starting this ssh session <strong>inside a screen session</strong> using a cron job.</p>
  
  <p><strong>How can I programmatically check if the remote port forwarding was successful?</strong></p>
  
  <p>The screen session can be checked with "screen -ls", the ssh session is also easily checked, but the remote port forwarding...?</p>
  
  <p>(Please let me know if this question is not clear enough! I've done my research but haven't found a simple solution.)</p>