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.

Possible Duplicate:
Leave bash script running on remote terminal while not logged in?

Hi All, I run a program, say ./a.out 10 from the shell prompt. Assume that there's a while(1) inside the program being run. Now if I try to close the shell, it warns me that it'll kill my running program too! So, how to kill the shell and still let my program continue running in the background?

I tried exec ./a.out 10 but the shell is still there. Another alternative is to simply double click my executable but then how will I pass command line parameters?

share|improve this question

migrated from stackoverflow.com May 31 '11 at 15:45

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Sathya May 31 '11 at 17:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
Same question here: superuser.com/questions/282350/… with some good answers, was closed as duplicate of superuser.com/questions/111631/…. –  user112553 May 31 '11 at 15:57

2 Answers 2

up vote 8 down vote accepted

nohup is a POSIX command to ignore the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out. The HUP (hangup) signal is by convention the way a terminal warns depending processes of logout.

Use nohup:

$ nohup ./a.out 10 &
$ exit
share|improve this answer

You may also want to run your program in a screen session.

share|improve this answer

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