Ed Roper on 25 Mar 2014 11:13:19 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] check for a file being transmitted via ftp


The clean way : lsof 
The dirty way : Have a 'trigger file' posted after uploading is complete. You don't move on the file you're watching until the trigger file shows up. I've seen this done in plenty of production environments, while it's totally a hack, it still works.


-----Original Message-----
From: plug [mailto:plug-bounces@lists.phillylinux.org] On Behalf Of Eric at Lucii.org
Sent: Tuesday, March 25, 2014 2:05 PM
To: Philadelphia Linux User's Group Discussion List
Subject: [PLUG] check for a file being transmitted via ftp

I expect a file to be routinely transmitted to me via ftp.  A bash script,
invoked as a cron job, will process and then archive that ftp file.

All of that is easy/routine.

My question is: how do I know that the file is complete?  I don't want to
start processing the file without being sure that the ftp process is done.

I thought about checking the size of the file in bytes and then comparing that
to it's size 1 minute earlier... if it's not growing then it's probably done.
But, that's just *probably* as ftp could be stalled temporarily or worse.

I have also considered about using inotify cron (incron) but I expect that it
would be triggered at the file's creation - not when it's time for me to
process it.

Thanks
Eric
-- 
#  Eric Lucas
#
#                "Oh, I have slipped the surly bond of earth
#                 And danced the skies on laughter-silvered wings...
#                                        -- John Gillespie Magee Jr
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug