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

Patrick McGovern members@kalamazoolinux.org
Thu, 26 Jul 2001 09:37:59 -0400


>>> adam@morrison-ind.com 07/26/01 08:03AM >>>

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....

We have a log monitor (Autosys on a Sun box).   
It has a process called file watcher that watches for file(s).  It monitors when it is safe
that this file has arrived and is done downloading based on whatever set conditions.  

The real intention here is morbid curiosity.  Does Unix have a command loaded with
options that could substitute for the function of a log monitor?  Indeed a script would 
be handy but it could entail scaling, maintenance problems, and 6.48*10^25
possible outer-rim occurances.  

Pat 

>>>>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?