4

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!

JordanBelf
  • 3,208
  • 9
  • 47
  • 80
  • 2
    Redirect your output to a file (or use tee) and then run the program "nohup ..." to ensure the disconnect doesn't kill it. BTW, I didn't put this as an answer as this isn't really a programming question :) – DrC Dec 19 '12 at 00:16
  • Thanks for both suggestions, I was not aware of tee or nohup so I will learn about them and implement them. Do you think the question is not suited for SO? Can I move it? – JordanBelf Dec 19 '12 at 00:22
  • I think it probably isn't quite SO material but I'm fairly new here as well. I don't know how or where to move it. – DrC Dec 19 '12 at 00:24
  • Yes I can't do much either. Lets see what others feel. Thanks anyway for your help. I think you should post it as an answer. – JordanBelf Dec 19 '12 at 00:27

3 Answers3

2

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.

DrC
  • 7,528
  • 1
  • 22
  • 37
1

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.

Sam Murphy
  • 815
  • 11
  • 23
0

You can use "screen". Detach from it and ping to google.com. So there ssh session will be active through out the installation.

zawhtut
  • 8,335
  • 5
  • 52
  • 76