The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 02:58 PM
Date/Time Stamp JimmyFlip UNIX for Dummies Questions & Answers 0 11-14-2006 11:49 PM
Inserting Date&Time Stamp In Existing Log File shephardfamily UNIX for Dummies Questions & Answers 3 02-24-2006 04:01 AM
Insert Time and Date Stamp aajmani Shell Programming and Scripting 1 10-13-2005 04:15 PM
File date and time stamp Xenon UNIX for Dummies Questions & Answers 1 10-09-2001 04:58 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-28-2005
jarich jarich is offline
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
}
  #2 (permalink)  
Old 07-28-2005
NPRao NPRao is offline
Registered User
  
 

Join Date: Aug 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.
  #3 (permalink)  
Old 07-28-2005
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,409
Time in seconds since a file was last modified...
Code:
perl -e '@q=stat($ARGV[0]); print time-$q[9]' file1
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0