When using SSH VPN tunnelling (-w option), is there a way to know when the tunnel is actually up? I want to use this in a script that automatically sets up the tunnel by running ssh -w then running ifup [1].The -f option doesn't help because it returns after connecting to the server but before the tunnel is up. Sleeping for a few seconds does work, but it just feels too hacky.The LocalCommand option seems to work, for example:ssh -w 0:1 -oLocalCommand=ifup tun0 -oPermitLocalCommand=yes myserver.example.org trueHowever, the man page says: The command is run synchronously and does not have access to the session of the ssh(1) that spawned it. Is the above invocation guaranteed to work or was it just luck that LocalCommand was executed after the tunnel is set up?More importantly, is there a standard way for using ssh -w in scripts?[1] I'm on Fedora, ifup works because I've set up/etc/sysconfig/network-scripts/ifcfg-tun0 and/etc/sysconfig/network-scripts/route-tun0
Waiting until SSH tunnel (ssh -w) is set up before running command
ssh