On Sun, Apr 27, 2008 at 9:30 AM, Michael Barnes <[EMAIL PROTECTED]> wrote:
>  So, I need my script to
>  create a pidfile when it starts.
>

There's not trick for creating a pid file in Perl.
You can say,

my $pid = $$;
open my $fd,'>', "/path/program.pid" or die $!;
print $fd $pid;
close $pid or die $!;

at the begin of the script.
And at the END block of the script you should delete the pid file when
script was exiting:

END {
    unlink "/path/program.pid" if $$ = $pid;
}


-- 
J. Peng - QQMail Operation Team
eMail: [EMAIL PROTECTED] AIM: JeffHua

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to