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 (Canon)
on Jan 12, 2019 at 07:50 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1228415]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-04-24 11:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found