in reply to Re: Daemon To Check For Files
in thread Daemon To Check For Files

  Then just check for any files with -M >= -M last-run

I think this is not a sure way to check that a file is not being written to though, say, an FTP process might have stalled, or a long running process that hasn't flushed its file handle yet...

To reliably check for the completion of a file, I think it is necessary to introduce some trigger files, or to have the process that creates the file to write to a different extension first, and then rename it to the matching extension.

Replies are listed 'Best First'.
Re: Re: Re: Daemon To Check For Files
by perrin (Chancellor) on Nov 05, 2003 at 03:26 UTC
    It's no worse than what he's already doing. Is there a way to ask the OS if any process has a file open for writing? I don't know of a way to do it off the top of my head. I think you'd need cooperation from the process doing the writing, which this person doesn't have.
      Hi perrin, on the unix system, use fuser (system V), fstat (BSD), pff (public domain) to find out various things about processes using a particular file (or files).

      I responded to your post earlier simply because I thought just checking a file's size to find out if it is still being written to is not a reliable method, not really related to the original post.

        Thanks, fuser seems to be on my Red Hat system, and looks easy to use.