Pel*_*eke 2 ssh ssh-tunnel upstart
我设置了以下新贵脚本:
# autossh
description "autossh connections"
start on started dbus
stop on (runlevel [06] or stopped dbus)
respawn
respawn limit 5 60 # respawn max 5 times in 60 seconds
script
export AUTOSSH_PIDFILE=/var/run/autossh.pid
export AUTOSSH_POLL=60
export AUTOSSH_FIRST_POLL=30
export AUTOSSH_GATETIME=0
export AUTOSSH_DEBUG=1
exec sudo -H -u pi -s autossh -M 0 \
-R remoteport:127.0.0.1:localport remoteuser@remote.host
exec sudo -H -u pi -s autossh -M 0 \
-R remoteport2:127.0.0.1:localport2 remoteuser@remote.host
end script
Run Code Online (Sandbox Code Playgroud)
但每次启动后我都会收到此错误消息:
ssh 提前退出,状态为 0
我该如何修复它?
谢谢
小智 5
您需要一个-N
选项,这样就不会创建交互式 shell。
exec sudo -H -u pi -s autossh -M 0 -N \
-R remoteport:127.0.0.1:localport remoteuser@remote.host
Run Code Online (Sandbox Code Playgroud)
从手册页(man
):
-N Do not execute a remote command. This is useful for just forwarding ports
归档时间: |
|
查看次数: |
3805 次 |
最近记录: |