> -----Original Message-----
> From: Johnson, Fred [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 20, 2002 10:13 AM
> To: [EMAIL PROTECTED]
> Subject: Time change
> 
> 
> Hello all,
>       I am working on a script to monitor the size of a 
> particular file and the time stamp of the file. My objective 
> is to alert some individuals via email when the file reaches 
> a certain size and/or when the time stamp of the file does 
> not match the current time. I'm stuck on how I can test for 
> the time stamp. I have been looking at the file test 
> operators, specifically, the -M. Some suggestions would be helpful.

What's the specific question?

  (stat $logFile)[9] gives the mtime for the file, in epoch seconds
  time() gives the current time, in epoch seconds

If those two are equal, the file time stamp matches the current time. But
that seems an odd thing to check for.

-M will subtract the mtime of the file from $^T, which is the value of
time() when your script started (unless you set $^T yourself to something
else). This value is then converted to *days*. This makes it quick to see if
a file is older than 30 days, for example:

   print "Old file" if -M $file > 30;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to