What happens to a process in an EC2 instance when I get a 'Broken Pipe' error on ssh?

删除回忆录丶 提交于 2019-12-24 03:26:24

问题


I am using some EC2 instances to run some large jobs I can not run locally. The issue I am seeing is that after a while (X hours since the process started) my connection on my shell gives me a broken pipe error

ubuntu@ip-10-122-xxx-xxx:~/stratto/ode$ Write failed: Broken pipe

The instance is still there because I can reconnect with no problems, but how can I reconnect and get back at seeing the logs of the process as before the 'Broken Pipe'

Any tip much appreciated, Thanks!


回答1:


Redirect your output to a file and then run the program "nohup ..." to ensure the disconnect doesn't kill it. Use "tail -f" to monitor the redirected file.

Note: Originally said to use "tee" but that won't work. I think a straight redirect and then tail on the file works.




回答2:


You can use screen to run processes in the cloud even when you are not connected to the server.

sudo apt install screen

To specifically address the issue described in the original post (e.g. connecting to AWS EC2 instances) I a basic example and a more advanced example of using screen.



来源:https://stackoverflow.com/questions/13943613/what-happens-to-a-process-in-an-ec2-instance-when-i-get-a-broken-pipe-error-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!