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.

When I run a process on a remote Linux machine, the process stops if the connection is terminated for some cause. This behavior is reasonable, because otherwise irrelevant processes would keep running forever.

However, is there a way to prevent this from happening? Namely, I want to open a remote shell, run a process and direct its output to a log file, and log out - but keep the process running.

Thanks,

Udi

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Well first option can be to spawn you program as another process with the & operator like

$ myprogram > file.log &

Or you can have a look at the screen command where you can store and retrieve your terminal sessions.

share|improve this answer

You can either use a screen session or push the process to background disconnecting it from the shell.

also check,

shopt -u huponexit

share|improve this answer
    
That's great - thanks! Perhaps nohup will work, too. –  Adam Matan Aug 26 '09 at 9:06

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.