Re: Limiting a program to a single running instance

2007-10-03 Thread Jeff Pang
2007/10/4, Mark Wagner <[EMAIL PROTECTED]>: > > Will an END block get executed even if the script exits through an > error such as calling an undefined function? > If script die by itself,END is executed. Some kill signals like SIGINT,SIGTERM can let script die and END be executed,but some won't,

Re: Limiting a program to a single running instance

2007-10-03 Thread Ken Foskey
On Wed, 2007-10-03 at 13:34 -0700, Mark Wagner wrote: > I've got a Perl program that is run once an hour as a cron job. > Normally it finishes its task in about ten minutes, but occasionally > it takes more than an hour to complete. When this happens, a second > copy is started, the two copies st

Re: Limiting a program to a single running instance

2007-10-03 Thread Mark Wagner
On 10/3/07, Bob McConnell <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: Elizabeth Cortell [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, October 03, 2007 4:48 PM > > To: beginners@perl.org > > Subject: Re: Limiting a program to a single r

Re: Limiting a program to a single running instance

2007-10-03 Thread Chas. Owens
On 10/3/07, Mark Wagner <[EMAIL PROTECTED]> wrote: > On 10/3/07, Elizabeth Cortell <[EMAIL PROTECTED]> wrote: > > > I suggest (untested, but we do something like this in the office): > > Upon startup, check for the existence of a lockfile with agreed-upon name > > in some tmp directory. If it exi

Re: Limiting a program to a single running instance

2007-10-03 Thread Chas. Owens
On 10/3/07, Elizabeth Cortell <[EMAIL PROTECTED]> wrote: > Checking for instances by grepping the output of ps tends to also catch > instances of > > vi myscript.pl > > So that innocently editing the file on that box keeps it from running! Not > what you have in mind, I think. snip Which is why

Re: Limiting a program to a single running instance

2007-10-03 Thread Mark Wagner
On 10/3/07, Elizabeth Cortell <[EMAIL PROTECTED]> wrote: > I suggest (untested, but we do something like this in the office): > Upon startup, check for the existence of a lockfile with agreed-upon name in > some tmp directory. If it exists, exit immediately; otherwise create the > file. Remove

RE: Limiting a program to a single running instance

2007-10-03 Thread Bob McConnell
> -Original Message- > From: Elizabeth Cortell [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 03, 2007 4:48 PM > To: beginners@perl.org > Subject: Re: Limiting a program to a single running instance > > Checking for instances by grepping the output of ps t

Re: Limiting a program to a single running instance

2007-10-03 Thread Elizabeth Cortell
Checking for instances by grepping the output of ps tends to also catch instances of vi myscript.pl So that innocently editing the file on that box keeps it from running! Not what you have in mind, I think. I suggest (untested, but we do something like this in the office): Upon startup, check

Re: Limiting a program to a single running instance

2007-10-03 Thread Chas. Owens
On 10/3/07, Mark Wagner <[EMAIL PROTECTED]> wrote: > I've got a Perl program that is run once an hour as a cron job. > Normally it finishes its task in about ten minutes, but occasionally > it takes more than an hour to complete. When this happens, a second > copy is started, the two copies step o