I frequently start background SSH tunnels using the
... -f -N -L ... options. This works great, until for example I sleep my machine, or my VPN credentials expire, when the tunnels stop working and I have to dig through the output of
ps to kill the old ones and restart. The symptom of the broken tunnels is a "Broken pipe".
Is there any way to instruct the
ssh process to exit when its pipe breaks? Then I could just restart my SSH tunnels when they die, and skip