When I start my xsession I setup my SSH tunnel to my VPS.
Here is the script the runs on login:
matt@HY731AA:~$ more dotfiles/startssh.sh
#!/bin/sh
ssh-add ~/.ssh/id_rsa
screen -dmS ssh /bin/bash -c ~/dotfiles/keeptunnel.bash
exit
Prompt to enter key and voila terminal closes..
And here is keeptunnel.bash
matt@HY731AA:~$ more dotfiles/keeptunnel.bash
#!/bin/bash
while [ true ];
do /usr/bin/ssh lin1tunnels > /home/matt/lin1tunnel.log 2>&1
sleep 0.4
done;
On login it seems everything works, tunnel is setup, however I leave my computer on 24/7 through various suspend/unsuspends etc.. The problem is occasionally the SSH tunnel is down, so I figure its just reconnecting or internet/server is down, however doing a screen -list shows the screened session is (Dead???) and to screen -wipe.
What I cant understand is given the loop in keeptunnels there is no way ppossible that screen should be able to exit? I have ConnectTimeout 8 and ServerAliveInterval 5 in .ssh/config for lin1tunnels however that I doubt is the source of the problem as the screened session is dead.
Ideas of why the screened session is dying?