[Dev] Re: [Dev] HOWTO write a daemon
Jeremy P
dev@trilug.org
Fri, 24 May 2002 09:35:24 -0400 (EDT)
On Fri, 24 May 2002, [iso-8859-1] Peter Long wrote:
> BTW: I was under the impression that just typing 'mydaemon&' would not work.
> I thought that the process would be terminated when I logged off in any
> case. Is there some way around that or am I just completely mistaken?
It won't die if you trap the appropriate signals (like SIGHUP, signal
1). SIGHUP is normally used to signal child processes that the user
logged off; for daemons it's trapped and is often used to reread the
configuartion file.
Even if you're not writing a program, you can block SIGHUP with the
"nohup" utility... read the man page for nohup (or "pinfo nohup" for the
better documentation). I think nohup also "nice's" the background
process, which you may or may not want.
--Jeremy