Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: how to run scripts uniquely

From: Douglas A. Tutty <dtutty(at)porchlight.ca>
Date: Thu Nov 22 2007 - 16:49:36 EST


On Thu, Nov 22, 2007 at 06:26:40PM +0000, cs wrote:
> I thought I'd worked out how to ensure only 1 instance of a shell script
> was running (using grep and wc) but I now see that sometimes the script
> name appears twice in the list of processes - any ideas?

Whenever I've needed to do that, I follow the 'standard' method with a file in /var/lock. Create a file with your script name and put its PID in it. Your script can then test for the existance of this file, read it, and verify the existance of the PID (remove the file if the PID is dead) and create its own lock file, removing it on successfull completion.

Doug.

-- 
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Received on Thu Nov 22 16:49:54 2007

This archive was generated by hypermail 2.1.8 : Mon Feb 25 2008 - 23:13:40 EST


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library