Autossh在一段时间后死亡

我的设置是

  • AWS上的Ubuntu 10.04
  • Autossh为MySQL创build隧道

隧道是使用Upstart(/etc/init/autossh.conf)自动创build的:

respawn console none start on (local-filesystems and net-device-up IFACE=eth0) stop on [!12345] script #user/IP Address redacted exec autossh -M 20000 -o StrictHostKeyChecking=no -L 3306:127.0.0.1:3306 xxxx@xxxx end script 

在启动时创build隧道,效果很好。 一些随机空闲时间后,它死亡。 有关如何保持活力的任何想法? 我不知道什么是杀autossh。

我的猜测是这是服务器上/etc/ssh/sshd_config文件中的超时设置。 随机性可能与mysql服务器没有为$idle_timeout_value发送数据的时间$idle_timeout_value

您应该能够检查服务器上的日志,查看是什么导致了断开连接。

 exec autossh -f -M 20000 -o StrictHostKeyChecking=no -NL 3306:127.0.0.1:3306 [email protected] 

我发现我需要-N允许-f在autossh上工作。 使用-f,它现在会下降到背景。 原来,root用户正在杀死autossh。

为什么,我不确定,但现在它更像真正的守护进程,这是完美的。