Making sure script only runs once instance at a time.

Matthew Warren Matthew.Warren at Digica.com
Fri Sep 29 16:10:22 CEST 2006


 


________________________________

	From: python-list-bounces+matthew.warren=digica.com at python.org
[mailto:python-list-bounces+matthew.warren=digica.com at python.org] On
Behalf Of Hari Sekhon
	Sent: 29 September 2006 14:55
	To: python-list at python.org
	Subject: Re: Making sure script only runs once instance at a
time.
	
	
	I'm not sure if that is a very old way of doing it, which is why
I was reluctant to do it. My way actually uses the process list of the
os (linux) and counts the number of instances. If it is more than 0 then
another process is running and the script exits gracefully.
	
	Also, apart from the fact the using lockfiles feels a bit 1970s,
I have found that in real usage of other programs within the company
that use lockfiles, it sometimes causes a bit of troubleshooting time
when it stops working due to a stale lockfile. This especially happens
when the program is killed, the lockfile remains and causes minor
annoyance (to somebody who knows that is, more annoyance to somebody who
doesn't).
	 
	 



This email is confidential and may be privileged. If you are not the intended recipient please notify the sender immediately and delete the email from your computer. 

You should not copy the email, use it for any purpose or disclose its contents to any other person.
Please note that any views or opinions presented in this email may be personal to the author and do not necessarily represent the views or opinions of Digica.
It is the responsibility of the recipient to check this email for the presence of viruses. Digica accepts no liability for any damage caused by any virus transmitted by this email.

UK: Phoenix House, Colliers Way, Nottingham, NG8 6AT UK
Reception Tel: + 44 (0) 115 977 1177
Support Centre: 0845 607 7070
Fax: + 44 (0) 115 977 7000
http://www.digica.com

SOUTH AFRICA: Building 3, Parc du Cap, Mispel Road, Bellville, 7535, South Africa
Tel: + 27 (0) 21 957 4900
Fax: + 27 (0) 21 948 3135
http://www.digica.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060929/5f1ac3da/attachment.html>


More information about the Python-list mailing list