in reply to flock for same file different scripts

Yes, using flock will allow you to safely edit the same file from two different scripts (or two different instances of the same script, or even one script and one C program).

  • Comment on Re: flock for same file different scripts

Replies are listed 'Best First'.
Re: Re: flock for same file different scripts
by jonnyfolk (Vicar) on Apr 20, 2003 at 20:46 UTC
    Thanks, grantm - that's eased my concern...

    Just for the record I have the impression that flock works on the filehandle rather than the file - is it the case that filehandles in all scripts should use the same name in order to flock properly, or is it the path/filename which holds sway?

    It's not a problem as I have used the same filehandle anyway, but just to get to the bottom of this...

      No, it's definitely the pathname that you're locking. The name you chose for the filehandle when you opened the file is not relevant to the locking process.

        That's great - thanks once again for your input, grantm