3

I had a background process running, of which the command starts with "nohup nice". As it takes usually 20 hours, so I had it running during the night. However, I got a message says "write failed: broken pipe" this morning, probably because the server closes connections that are idle for too long. When I logged into the server again, there's no job when I type the "jobs" command. How can I restart the program from where it's left instead of running from the beginning?

1
  • Where did you see that "message"? In nohup.out? Nov 8, 2015 at 13:55

1 Answer 1

5

It depends on where you saw that message. If you are connecting to the server via ssh and saw this on your local terminal, you're fine. The process is probably still running happily on the remote server. You won't see it in jobs because jobs only shows processes running in the current shell session. If you have reconnected to the server, you will have started a new session so jobs won't help. Try running ps aux | grep ProcessName to check whether it is still running.

If you saw this message in nohup.out or in your output file, you can't. Not unless it's a process that somehow supports resuming. The error means that the process was stopped. Since it was stopped, it is gone, there's no way of getting it back.

If this was, for example, reading an input file and producing output, you could try to figure out when it stopped and run it again giving only the remaining lines as input. There's no trick that can tell it to magically restart though, since there is no record of when it stopped.

1
  • Thank you very much. It shows in the output file, so I guess it's gone. I also tried running the remaining lines as you suggested, but the broken pipe happened again. I first thought it might be the connection problem, but it turned out to be not, nor because of the possibility of running out of disk space.. So I haven't figured out what the problem is. Anyway, thank you for solving the "restarting" problem, you explained very well! Nov 9, 2015 at 14:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .