Waiting until tunnel (ssh -w) is set up before running command
Ibrahim M. Ghazal
imgx64 at gmail.com
Thu May 15 02:20:05 EST 2014
When using 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
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"
However, 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?
 I'm on Fedora, ifup works because I've set up
More information about the openssh-unix-dev