Forcing SSH Process to continue running
I hope this is the right forum.
I was running a large program on a remote SSH server the other day when I was disconnected. This is a large program, ~48 hours to complete, and I was disconnected around hour 40. I have restarted the program using the following (Note: I am already ssh'd into the server) ./20090427_9crossing > 20090427_9crossing.out & Now, I believe this will run the program in the background and output to the file. So, if I get disconnected again will it continue to run? If not, is there a way that I can get it to keep running? |
I believe you've detached the command from your terminal with the ampersand (&), so I think you should be fine. You can log back into the machine and check to see if your process is still running with the ps command.
|
Hi,
The ampersand puts your command in the background, it doesn't detach it from the terminal. Use nohup to accomplish that. nohup command & Output that is created by the command is written to a file (in the dir you started the command). |
So, would that mean his command was ended on session disconnect?
|
Hi,
The OP did not give any details, there could be a lot of (deliberate: security!) reasons why the session was closed: A time limit on idle ssh sessions or idle logins are at the top of my 'probably' list ;) The command I gave (nohup command &) will avoid stopping the program from running when the shell is detached, not the disconnect itself. After the nohup command you can log out and the command will keep running until it is done. |
Hi...
Also you can run "screen" to manage severals shells. "screen" to start it [ctl] (a , c) to create a new shell (sequence) [ctl] (a , n) to go the next shell [ctl] (a , d) to detach "screen -rd" to retake the last (n) session(s) regards |
To clarify: there is not a time limit or idle close, as these boxes are dedicated to running large programs. When using nohup, it seems that if I close the shell and then reopen it the command has stopped. My problem is when my network (at home) goes down, as my ISP sucks, is there a way to keep the program going?
|
Hi,
The nohup command does what you want: After logging in remotely start your command with: nohup whatever.the.command & You should get the prompt back and a message from nohup, something like this: Quote:
Check with ps -ef | grep whatever.the.command. You can also check the nohup.out file in real time (if your program outputs anything that is) with tail -f nohup.out This solution solves your connection problem as well. |
All times are GMT -5. The time now is 08:44 PM. |