The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
file comparison...help needed. er_ashu UNIX for Dummies Questions & Answers 4 05-15-2008 06:37 PM
file comparison script tiger99 Shell Programming and Scripting 1 01-30-2008 07:47 AM
File Comparison net_shree Shell Programming and Scripting 19 01-10-2008 05:00 PM
Help with time comparison shell script for HP-UX gummysweets Shell Programming and Scripting 6 10-12-2005 07:48 AM
Newbee Needs Help - Time comparison danedder Shell Programming and Scripting 4 05-25-2005 09:26 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-23-2003
Registered User
 

Join Date: Nov 2001
Location: Fort Worth
Posts: 10
Exclamation File Time Comparison Question

I want a cron job to fire off every 5 minutes or so to verify that a
file in a directory is not more than 15 minutes old (from the current
time. If the newest file is more than 15 minutes old, I would fire
off an email..

The email part is easy, but I'm having trouble figuring the logic
behind the comparison..

Any thoughts?
Forum Sponsor
  #2  
Old 07-23-2003
davidg's Avatar
Registered User
 

Join Date: Jul 2003
Location: Holland
Posts: 207
Hi,

I knew I'dd seen this question before.
The thing is that the command "find" will only count per day (24 hours), so therefor you'dd make a refference file :

touch -amt 07231951 /tmp/ref

And use the -newer option from find :

find /tmp -newer /tmp/ref

If it results anything you know it's older, right ?

Also a perl-script could help you out a bit. You should do some work still, thought

#!/opt/perl/bin/perl

$filename = "$ARGV[0]";

@s = stat($filename);

$atime = localtime($s[8]);
$mtime = localtime($s[9]);
$ctime = localtime($s[10);

print "Time of the last access (atime) = $atime\n";
print "Time of last inode change (ctime) = $ctime\n";
print "Time of the last modification (mtime) = $mtime\n";

@yourservice
David
  #3  
Old 07-23-2003
Registered User
 

Join Date: Nov 2001
Location: Fort Worth
Posts: 10
Thanks !

Thanks for your responce.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 01:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0