> 
> If it's not possible to use Proc::Daemon, what would be the other 
> options, please?
> 
> Your help will appreciated so much.
> 

I also had to roll my own daemon. actually i would like to here suggestions
from drieux or anyone on how i can improve this. Proc::Daemon is not an
option for me either:

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;
} 


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

Reply via email to