Re: Creating PID file
- From: peng.kyo@xxxxxxxxx (J. Peng)
- Date: Sun, 27 Apr 2008 09:50:51 +0800
On Sun, Apr 27, 2008 at 9:30 AM, Michael Barnes <mbarnes@xxxxxxxxxxxx> 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: peng.kyo@xxxxxxxxx AIM: JeffHua
.
- Follow-Ups:
- Re: Creating PID file
- From: J. Peng
- Re: Creating PID file
- References:
- Creating PID file
- From: Michael Barnes
- Creating PID file
- Prev by Date: Re: Creating PID file
- Next by Date: Re: Creating PID file
- Previous by thread: Re: Creating PID file
- Next by thread: Re: Creating PID file
- Index(es):
Relevant Pages
|
|