On Sun, Apr 27, 2008 at 4:59 AM, J. Peng <[EMAIL PROTECTED]> wrote:
> On Sun, Apr 27, 2008 at 4:53 PM, Chas. Owens <[EMAIL PROTECTED]> wrote:
> > On Sun, Apr 27, 2008 at 2:49 AM, Michael Barnes <[EMAIL PROTECTED]> wrote:
>
>
> > #make sure the last thing done is the removal of the pidfile
> > #note: this happens even if we die
> >END {
> > our $program;
> > unlink("/var/run/$program")
> > or die "could not delete /var/run/$program";
> >}
>
>
> As I have said (in fact it's said by Lincoln Stein), you should add a
> "if" statement here to avoid the childs delete the pid file when
> they're exiting.
>
> if ( $$ == $pid ) { # $pid is parent's pid
> unlink $pidfile or die $!;
snip
If the code forks (without an exec), then this is a good point.
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/