How can I find out when another process stops writing a file in Perl?

I have a system that writes files to a folder using FTP. I need to copy these files, but only when they have finished working with the FTP system. How to find out when the first process completed.

+4
source share
4 answers

Another possibility is to have a process that download files, download them under a temporary name, and then rename them.

Renaming occurs atomically, so there would be no case when the file was incomplete under its final name.

The copy process may ignore temporary named files.

+11
source

To extend the idea of ​​zoul: specify the file that indicated the last time the target was updated. After each download, you touch this file.

The cron process, on the other hand, can periodically check for updates and do its job.

+3
source

The easiest way is to create a file indicating the completed transfer?

+1
source

You should use Linux :: Inotify2 , this is done for this kind of thing! :)

Just view the "IN_CLOSE" event in your FTP directory ...

0
source

All Articles