in reply to Re: how can i find whether a file has been opened by some other process across a network(not in a single machine)?
in thread how can i find whether a file has been opened by some other process across a network(not in a single machine)?

Thanks psychotic, My requirement is a part of a script that updates a file thats been used by many applications/users (they canmanually edit them). So, everything has to be done automatically. anyways thanks for your response
  • Comment on Re^2: how can i find whether a file has been opened by some other process across a network(not in a single machine)?

Replies are listed 'Best First'.
Re^3: how can i find whether a file has been opened by some other process across a network(not in a single machine)?
by psychotic (Beadle) on Dec 05, 2005 at 12:44 UTC
    It might be worthwhile mentioning why you need to check if a file is already open, and what exactly you mean by that. For instance, if a program has opened a given file with an advisory flock and expects mutual flocking your script can still read/write it's contents, even if that will perhaps lead to unpredictable results. It all comes down to what you are trying to achieve.

    Sometimes, the solution to a problem comes along easier if the whole picture is presented. It's like a painting. You are showing us a tree, and we say "nice". But you never mention about the beautiful lake right beside it, which makes us go "wow". ;)

      Here's a scenario I have a configuration file, say config.txt. which actually gets updated by one of my programs, say update_config.pl. Now, a user can open the file and see the content of the file, config.txt while somebody else is using the update_config.pl program. Now, if the user who had kept the config.txt file opened saves while closing te file, the change made by the update_config.pl is lost. I want to avoind this situation. I hope i've painted the picture of my lake to your liking :)