Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

How do I know if a file is used by another process?

by Anonymous Monk
on Jul 13, 2000 at 13:02 UTC ( #22340=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

How do I know if a file is used by another process?

Originally posted as a Categorized Question.

  • Comment on How do I know if a file is used by another process?

Replies are listed 'Best First'.
Re: How do I know if a file is used by another process?
by nardo (Friar) on Jul 13, 2000 at 21:04 UTC
    If you're only worried about multiple copies of your program accessing the same file, you can use file locking perldoc -f flock, otherwise you could parse the output of lsof (assuming lsof is installed on your machine).
Re: How do I know if a file is used by another process?
by dempa (Friar) on Jul 13, 2000 at 21:46 UTC
    Maybe non-generic answers sucks, but anyway, if you should happen to be on a Solaris box, you could always use the command "fuser". I dunno in which release of Solaris it was introduced, but it's present in 2.6, 7 and 8.
Re: How do I know if a file is used by another process?
by lindex (Friar) on Oct 28, 2002 at 09:20 UTC
    I had a post about this a while ago here

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://22340]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2021-04-20 03:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?