have you tested that well? i just days ago did the same and found...
# Proc/PID/File.pm sub alive { my $self = shift; my $pid = $self->read(); print "> Proc::PID::File - pid: $pid" if $self->{debug}; return $pid if $pid && $pid != $$ && kill(0, $pid); # $self->write(); return 0; } # i've commented out the write() because i don't think that testing # for aliveness should write a pidfile... sub DESTROY { my $self = shift; $self->remove() if $self->{path} and $self->{written}; } # i've added a written test so i don't remove pidfiles that aren't min +e # add this to the end of write() $self->{written} = 1; # add this to file() $self->{written} = 0;
because:
would delete the pidfile that it found...die "Already running!" if Proc::PID::File->new()->alive();
In reply to Re: Re: Keeping File Locks after Daemonization
by zengargoyle
in thread Keeping File Locks after Daemonization
by SIGSEGV
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |