On Thursday, May 16, 2002, at 03:24 , Michael Lamertz wrote:
[..]
>
> 1. get out of the parent's (in that case your shell's) process group.
> We'll have PPID 1 after this call.  The only error that setsid can throw
> is EPERM which means that we already are process group leader.
>
> 2. move up to the root directory, so that we're not blocking filesystems
> that one might want to unmount (e.g. /opt)
>
> 3. close all those rotten filehandles who's output nobody will see
> anyways...
[..]

which is basically provided for in

        use Proc::Daemon;

the problem is that it closes both stdin and stderr, which are
used by other things we play with and need to be appropriately
reopened to some place other than the terminal we are no
longer talking to...

I'm all in favor of cluttering up syslog with JUNK - but most
of the decent sysAdds will allow that over my dead body....
{they never say, 'over my dead body' - they always say it
expressly as 'Right, yeah sure, over your dead body that's gonna happen'}


the following is WAY UGLY - but it actually works.

        http://www.wetware.com/drieux/pbl/Sys/daemon1.txt

It leaves a pid file out there so that when called as

        daemon1 -k

it does the decent thing and kills off the currently running one...

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to