I want my Linux computer to automaticly create an ssh tunnel to a server. I have created keys, everything works fine if i connect by hand.
Here what i tried in supervisor.conf on the client computer:
[program:mycommand]
command=autossh -f -nNT -i /home/<myuser>/.ssh/id_rsa -R 20001:localhost:22 ssh1@<myserver_ip_address>
user=<myuser>
or
[program: mycommand]
command=ssh -i /home/<myuser>/.ssh/id_rsa -R 20001:localhost:22 ssh1@<myserver_ip_address>
user=<myuser>
autostart=true
autorestart=true
stopsignal=KILL
It works in both case, but, sometimes, i lost connexion (in both case). I need to reboot the serveur or the client computer. What should i do in order to detect that my ssh tunnel is down and launch again the command ?
Thanks