On Tuesday, August 13, 2002, at 05:47 , Kipp, James wrote:
[..]
> sub start_d {
>         umask 0;
>         open (STDIN, "/dev/null")   or die "Can't read /dev/null: $!";
>         open (STDOUT, ">/dev/null") or die "Can't write to /dev/null: $!"
> ;
>         open (STDERR, ">&STDOUT") or die "Can't write to /dev/null: $!";
>
>         # fork a child
>         defined(my $pid = fork)   or die "Can't fork: $!";
>
>         # exit parent and let child take over.
>         exit if $pid;
>
>         # start a new proc group with our kid
>         setsid() or die "Can't start a new session: $!";
>
>         # handle kill or term  signal and and kill zombies
>         $SIG{TERM} = 'IGNORE';
>         sub REAP { 1 until waitpid(-1, WNOHANG) == -1 }
>         $SIG{CHLD} = \&REAP;
> }

a couple of basic concerns.....

        a) your redirect of STDERR, STDOUT
                means that you will be losing all of your 'WARNING'
                        and other messaging that would be going to STDERR
                        and/or STDOUT - unless you have a sighandler installed
                        to catch the 'warning' messages that may be burbling
                        up from underlying code...

        note: your die there will go into the Ether, and not to
                        say something like

                        /tmp/my_daemon.stderr

        where you would be able to note that it furrBalled on
        your setsid() call....

        b) it is not clear to me, from this segment, that you are
                laying a PIDFILE to simplify the method by which you
                do the simple 'shutdown' of daemons by sending them a
                signal....



ciao
drieux

---


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

Reply via email to