[英]ssh tunnel script hangs forever on beanstalk deployment
在將應用程序部署到aws beanstalk時,我正在嘗試創建一個ssh隧道。 我想將隧道作為后台進程,在應用程序部署時始終連接。 腳本永遠掛在部署上,我看不出原因。
"/home/ec2-user/eclair-ssh-tunnel.sh":
mode: "000500" # u+rx
owner: root
group: root
content: |
cd /root
eval $(ssh-agent -s)
DISPLAY=":0.0" SSH_ASKPASS="./askpass_script" ssh-add eclair-test-key </dev/null
# we want this command to keep running in the backgriund
# so we add & at then end
nohup ssh -L 48682:localhost:8080 ubuntu@[host...] -N &
這是我從/var/log/eb-activity.log
得到的輸出:
[2019-06-14T14:53:23.268Z] INFO [15615] - [Application update suredbits-api-root-0.37.0-testnet-ssh-tunnel-fix-port-9@30/AppDeployStage1/AppDeployPostHook/01_eclair-ssh-tunnel.sh] : Starting activity...
SSH通道被催生,我可以做找到它:
[ec2-user@ip-172-31-25-154 ~]$ ps aux | grep 48682
root 16047 0.0 0.0 175560 6704 ? S 14:53 0:00 ssh -L 48682:localhost:8080 ubuntu@ec2-34-221-186-19.us-west-2.compute.amazonaws.com -N
如果我終止該進程,則部署將按預期繼續,這表示該錯誤位於隧道腳本中。 我似乎無法找到它的位置。
在后台運行時,需要向ssh添加-n選項以避免從stdin讀取。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.