Tom McCurdy, Jr. on 25 Mar 2014 11:34:17 -0700


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

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


You could use MD5SUM to help verify the integrity of the file you're downloading.


For example, if the file you are pulling from the FTP server is foo.txt, the creator would generate an MD5SUM hash value on that file and place the resulting hash value into a text file named, foo.md5.  You can then setup your script to download both files, run an MD5SUM on the foo.txt and compare the resulting hash value to the value in foo.md5.

For more information, have a look at the MD5SUM Wikipedia page:

http://en.wikipedia.org/wiki/Md5sum

-Tom



On Tue, Mar 25, 2014 at 2:05 PM, Eric at Lucii.org <eric@lucii.org> wrote:
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