X
Xaonon
I have a signature generation program that I want to have become a daemon
and write to a named pipe. Currently, the section of code responsible for
daemonizing it looks something like this:
if ( my $pid = fork ) { print "$0: forked to PID $pid\n"; exit; }
elsif( not defined $pid ) { die "$0: fork failed: $!\n"; }
else { setsid; }
So far it works, but there's always the possibility that it could be screwed
up by something I haven't considered. This is the first Perl program I've
written as a daemon and I want to make sure that I've done it correctly. Is
there anything more that I need to have it do?
The entire program is available for consideration at:
http://xaonon.dyndns.org/about/randsig.pl
Please let me know if I've done anything stupid, as well. Thanks.
and write to a named pipe. Currently, the section of code responsible for
daemonizing it looks something like this:
if ( my $pid = fork ) { print "$0: forked to PID $pid\n"; exit; }
elsif( not defined $pid ) { die "$0: fork failed: $!\n"; }
else { setsid; }
So far it works, but there's always the possibility that it could be screwed
up by something I haven't considered. This is the first Perl program I've
written as a daemon and I want to make sure that I've done it correctly. Is
there anything more that I need to have it do?
The entire program is available for consideration at:
http://xaonon.dyndns.org/about/randsig.pl
Please let me know if I've done anything stupid, as well. Thanks.