[Peeweelinux] background thread exits with telnet end

Mark Meade [email protected]
Sun, 13 Apr 2003 09:56:14 +0000


On Sunday 13 April 2003 12:30 am, Ricardo Trindade wrote:
> 	I run my program with ./program& on a telnet session, but it exits when
> the telnet session ends. Isn't linux supposed do daemonize background
> threads ? If not, how can I do it ? should I use nohup ?

Hi Ricardo,

Linux doesn't daemonize in this case -- your program is still attached to its 
parent (your telnet session), and it will exit when the parent exits.

If your are programming in C, the following is a good example of how to 
"daemonize" a process, using the fork() system call.

http://www.enderunix.org/docs/eng/daemon.php

Mark