tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How to properly daemonize?



> The list in _Advanced Programming in the Unix Environment_
That list answeres just a tiny subset of my questions (mainly, that indeed 
SYSV is the system where a session leader automatically acquires a control 
tty if it happens to open a tty).
Strangely, it doesn't mention the re-parenting at all.

Perhaps I should state more clearly what my questions are
-- is the re-parenting to PPID 1 just to have someone wait()?
-- what exactly is the point (save sanity) of redirecting stdXXX to /dev/null?
-- which flags to open() /dev/null with for stdXXX?
-- is opening /dev/null and dup2()ing to stdXXX just an optimization?
-- what's the point of some daemons assuring the outer process doesn't exit
   before the innermost actually runs?

And:
-- is there a way to detach in a shell script?


Home | Main Index | Thread Index | Old Index