Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Read, SFTP Put and Move Files from a "Busy" NFS FileSystem

by soonix (Abbot)
on Jan 12, 2019 at 07:50 UTC ( #1228415=note: print w/replies, xml ) Need Help??


in reply to Re^2: Read, SFTP Put and Move Files from a "Busy" NFS FileSystem
in thread Read, SFTP Put and Move Files from a "Busy" NFS FileSystem

However, since we're talking about NFS, the file may be opened (written) from a different computer. In this case, lsof would work at most on the server, but not from another client.
  • Comment on Re^3: Read, SFTP Put and Move Files from a "Busy" NFS FileSystem

Replies are listed 'Best First'.
Re^4: Read, SFTP Put and Move Files from a "Busy" NFS FileSystem
by kschwab (Vicar) on Jan 12, 2019 at 16:46 UTC

    I suppose a poor man's subsitute would be to just stat all the *.xml files, sleep for 10 (30?) seconds, stat them all again, and skip any where the filesize has changed. Not perfect, but probably works most of the time. Probably more reliable than just processing any file more than 2 seconds old.

    Another thought...use the Linux inotify() api so that you can be more event oriented. See Linux::Inotify2. Then, every time a new file is created in the directory, you get an event. That would keep you from having to scan the directory. Though, it would increase the risk of processing a "in-use" file, so you'd need pretty good logic to determine when the file is done being written.

      Does Inotify work for NFS? I think it only tells you about changes performed locally.
        Ah, yes, it would have to run on the NFS server...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2019-07-22 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If you were the first to set foot on the Moon, what would be your epigram?






    Results (22 votes). Check out past polls.

    Notices?