Re: Creating PID file

2008-04-27 Thread Rob Dixon
Michael Barnes wrote: > > From: Jenda Krynicky [mailto:[EMAIL PROTECTED] >> >> Michael Barnes wrote: >>> >>> My apologies. I know this is a cross-platform group, and that is >>> fine. However, if you are unable to understand simple Linux >>> terminology, then it is doubtful that you can help an

RE: Creating PID file

2008-04-27 Thread Michael Barnes
-Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED] Sent: Sun 4/27/2008 3:11 AM To: Michael Barnes Subject: RE: Creating PID file Subject:RE: Creating PID file Date sent: Sat, 26 Apr 2008 23:49:23 -0700 From: "Michael B

Re: Creating PID file

2008-04-27 Thread Chas. Owens
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 > > #no

Re: Creating PID file

2008-04-27 Thread J. Peng
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/$pr

Re: Creating PID file

2008-04-27 Thread Chas. Owens
On Sun, Apr 27, 2008 at 2:49 AM, Michael Barnes <[EMAIL PROTECTED]> wrote: > My apologies. I know this is a cross-platform group, and that is fine. > However, if you are unable to understand simple Linux terminology, then it is > doubtful that you can help answer my question. If the descriptio

Re: Creating PID file

2008-04-27 Thread Octavian Rasnita
ecause the same program may be ran with different command lines or links to it. Am I wrong? Octavian - Original Message - From: "Michael Barnes" <[EMAIL PROTECTED]> To: Sent: Sunday, April 27, 2008 4:30 AM Subject: Creating PID file This may be a bit advanced for

RE: Creating PID file

2008-04-26 Thread Michael Barnes
s. I need the script to determine its own pid, then write that to a file. Thanks, Michael -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Sat 4/26/2008 6:49 PM To: beginners@perl.org Cc: Michael Barnes Subject: Re: Creating PID file Michael Barnes wrote: > >

Re: Creating PID file

2008-04-26 Thread J. Peng
On Sun, Apr 27, 2008 at 9:50 AM, J. Peng <[EMAIL PROTECTED]> wrote: > > END { > unlink "/path/program.pid" if $$ = $pid; sorry, it's "==" not "=". unlink "/path/program.pid" if $$ == $pid; This avoid the child (if have) try to delete the pid file when it exits. > } -- J. Peng -

Re: Creating PID file

2008-04-26 Thread J. Peng
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 d

Re: Creating PID file

2008-04-26 Thread Rob Dixon
Michael Barnes wrote: > > This may be a bit advanced for a beginner's group, but I need to have my > script create a pidfile. I'm running a monitor app that keeps track of > what is running and notifies me when stuff stops. It does it by > comparing the pid in the pidfile with ps. So, I need my

Creating PID file

2008-04-26 Thread Michael Barnes
This may be a bit advanced for a beginner's group, but I need to have my script create a pidfile. I'm running a monitor app that keeps track of what is running and notifies me when stuff stops. It does it by comparing the pid in the pidfile with ps. So, I need my script to create a pidfile when