The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
rsync - date/time stamp prvnrk UNIX for Advanced & Expert Users 4 04-11-2008 10:58 AM
Date/Time Stamp JimmyFlip UNIX for Dummies Questions & Answers 0 11-14-2006 08:49 PM
Inserting Date&Time Stamp In Existing Log File shephardfamily UNIX for Dummies Questions & Answers 3 02-24-2006 01:01 AM
Insert Time and Date Stamp aajmani Shell Programming and Scripting 1 10-13-2005 12:15 PM
File date and time stamp Xenon UNIX for Dummies Questions & Answers 1 10-09-2001 12:58 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-28-2005
Registered User
 

Join Date: Jul 2005
Posts: 1
Date Time Stamp

I'm trying to write a script that checks the DTS of a file the compares it to the current time. If greater that 60 mins has gone by and the file has not been written to alert.

So far I have the time pulled from the file but I dont know how to compare the times against a 60 min difference.

#!/bin/ksh
# Check to see if the Control File has been updated hourly

stime=`date +%H:%M`
CHECK()
{
ls -al | grep filename |awk '{ print $8 }' > $ntime
}
Reply With Quote
Forum Sponsor
  #2  
Old 07-28-2005
Registered User
 

Join Date: Jul 2004
Location: Pacific NW, USA
Posts: 6
Did you try to use find command with different options like -
Quote:
-mmin n
File's data was last modified n minutes ago.

-mtime n
File's data was last modified n*24 hours ago.
Reply With Quote
  #3  
Old 07-28-2005
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,249
Time in seconds since a file was last modified...
Code:
perl -e '@q=stat($ARGV[0]); print time-$q[9]' file1
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:54 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