[KLUG Members] Best command to monitor file size change over time?

Adam Tauno Williams members@kalamazoolinux.org
Thu, 26 Jul 2001 08:03:32 -0400 (EDT)


>>>>I am looking for a good Unix command (find?) or Korn shell
>>>>script Can you be more specific?
>>The file would be arriving FTP to a given location at a given time(s)
>>each day.  A program is needed that would do the following:
>>1. Wait for the arrival of a file that is expected to come to a given
>>server at an approximate  time.
>>2. Monitor the FTP process by testing for increasing file size.  When
>>the file stops growing for a safe amount of time (I am just using a minute
>>for a "wait" period.  Perhaps this is too long) the file is then available
>>for operations.
>>>It would be trivial to write a script to write a small shell
>>>script
>>>to monitor a file to see if the size or contents of a files
>>>changes in 60 seconds (assuming you have access to the file).
>>Don't bother.  Just wondered if anyone has a similar process to
>>compare and save time.
>I don't have anything exactly like that, but like I said, it sounds
>easy. I'd only take me a minute or two to write something if you like.  It's
>not a problem.  If so, I'll need to ask you a couple more questions.
>1)  When this script starts, does the file exist (left over from the
>    previous day) or is not there (removed when it's done being
>    processed)?
> 2)  Approximate size of the file?
> 3)  Is this script running on Linux or some other *nix?

If your going to watch for the *arrival* of a file on an FTP server I think you
would be much better off to use a log monitor rather than trying to timer-watch
the actual file.  Having done things like this I know that there are 6.48*10^25
possible outer-rim occurances that came make a timer-watcher confused:  What if
the file transfer starts but doesn't complete?  What if the sent file is the
exact same size as the previously sent file? etc....

Systems and Network Administrator
Morrison Industries
1825 Monroe Ave NW.
Grand Rapids, MI. 49505