Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Say I'm running a task on a remote (Ubuntu) server which last hours, but I need to disconnect my shell client now. Foolishly, I didn't use screen or think of starting the task with nohup.

Is there a way to perhaps pause the task, then start it up in the background so it will continue even with my terminal disconnected?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

If you're not interested in the output, you can use Ctrl-Z and then bg to run the task in the background, and then disown to stop the shell sending it a SIGHUP when you disconnect.

share|improve this answer
    
Awesome. I didn't know about disown. Weirdly it doesn't have a man page or any help. –  Steve Bennett Jun 7 '12 at 8:46
    
And out of curiosity - if I am interested in the output? –  Steve Bennett Jun 7 '12 at 8:46
    
On RHEL man disown opens BASH_BUILTINS(1) which has a bit more information. –  Bram Jun 7 '12 at 9:56
    
If you are interested in output, you could start screen and use something like reptyr to reparent it. –  nickgrim Jun 10 '12 at 21:09
    
This explains it more: serverwatch.com/tutorials/article.php/3935306/… –  Steve Bennett Sep 4 '13 at 3:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.