JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for LINUX-UK-HELP Archives


LINUX-UK-HELP Archives

LINUX-UK-HELP Archives


LINUX-UK-HELP@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

LINUX-UK-HELP Home

LINUX-UK-HELP Home

LINUX-UK-HELP  June 2005

LINUX-UK-HELP June 2005

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: Open file

From:

Richard Kay <[log in to unmask]>

Reply-To:

Richard Kay <[log in to unmask]>

Date:

Fri, 10 Jun 2005 11:37:43 +0100

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (38 lines)

On Fri, Jun 10, 2005 at 10:40:34AM +1000, Harvey, Allan AC wrote:
> Hi all,
> 
> Can anyone offer a method of testing if a file is open
> by another process from within in a script?

Depends upon the language of the script. First have a look at 

man 2 flock

and see if this function is what you want. Scripts could either
call a utility program to use flock(2), or better (as is the
case with Perl) have
wrapper functions around it. The "Programming Perl"  book
advises that flock() is not safe on a network
file system e.g. NFS.

I have reused the Python Mailman locking module in some of my
own Python scripts by lifting this module file from the 
Mailman source and making a minor modification.

You can extract a copy of this LockFile.py version from
http://copsewood.net/py_lets_cgi/letscgi.tar.gz

or get the original from http://www.list.org/   

Even if you don't plan using Python, I think
you will find reading this source file and
experimenting with it informative 
concerning file locking. 

Cheers,
Richard.

> 
> Ta,
> 
> Allan

Top of Message | Previous Page | Permalink

JISCMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

January 2013
May 2008
August 2007
June 2007
December 2006
August 2006
July 2006
June 2006
May 2006
February 2006
January 2006
December 2005
October 2005
September 2005
July 2005
June 2005
May 2005
September 2004
July 2004
June 2004
May 2004
April 2004
January 2004
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
January 2003
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
January 2001
December 2000
November 2000
October 2000
September 2000
August 2000
July 2000
June 2000
May 2000
April 2000
March 2000
February 2000
January 2000
December 1999
November 1999
October 1999
September 1999
August 1999
July 1999
June 1999
May 1999
April 1999
March 1999
February 1999
January 1999
December 1998
November 1998
October 1998
September 1998


WWW.JISCMAIL.AC.UK

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager