2

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?

2 Answers2

8

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
dogbane
  • 4,746
1

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