I wrote the following command in
ssh -R 32400:192.168.0.100:32400 email@example.com -N
but it won't start.
Any idea why?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
Maybe the network isn't ready yet, when
rc.local is executed.
The following code will wait for the network before connecting:
( until ping -nq -c3 W.X.Y.Z; do # Waiting for network sleep 5 done ssh -R 32400:192.168.0.100:32400 firstname.lastname@example.org -N )&
W.X.Y.Z is an IP address that is reachable and replies to pings. It maybe be the default gateway of your network, the Google DNS (22.214.171.124), etc.
Code between parenthesis runs in a new shell, and the
& makes it run in background. It won't block the execution of
The commands between
done will be repeated until the
ping is successful, i.e., it gets a reply (i.e., the network is up).