Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a bash script that takes several hours to run. While it's running, I would like to do other things, which may involve logging out or disconnecting from the internet (my script runs network tests on various computers).

I understand that there is a command that would allow me to run my tests from a remote terminal and logout of the terminal while it runs. Does anyone know what this command is?

Thanks

share|improve this question

1 Answer 1

up vote 10 down vote accepted

The command you are looking for is nohup.

There is also screen, which is for when you want to leave something running but come back and reattach interactively later.

nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively.

share|improve this answer
    
I looked at nohup right now and apparently there are issues with input and output which might cause the script to hang up. I also saw something about screen, which strikes me as what I had read about before. Do you know how to use either of these? –  mechko Feb 21 '10 at 17:18
1  
nohup is for when a script expects no user input - it saves all output to a file. Screen is for when you want to leave something running but come back and reattach interactively later. nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively. –  Justin Smith Feb 21 '10 at 17:22
    
Ah found it. For screen, it's ctrl-A d to detach and -r +pid to reattach. –  mechko Feb 21 '10 at 17:23
    
Good answer. You should add the screen comment to you answer so that it stands out more. –  DaveParillo Feb 21 '10 at 22:13

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.