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 > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find the age of a file in Minutes hari_anj Shell Programming and Scripting 1 03-18-2008 06:22 AM
Find accessed file in past 1 or 2 minutes, and throw mail. varungupta UNIX for Advanced & Expert Users 2 09-12-2007 03:07 AM
Find files on minutes basis er_aparna Shell Programming and Scripting 3 07-16-2006 09:57 PM
only find files older than x minutes old dsimpg1 Shell Programming and Scripting 1 05-18-2006 11:48 PM
finding files only minutes old? cstovall Shell Programming and Scripting 2 01-12-2005 09:06 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-05-2005
sveera sveera is offline
Registered User
  
 

Join Date: Mar 2005
Location: INDIA
Posts: 60
Red face find files onder than 15 minutes

Hi Friends,

i have to write a script to raise a flag if there are any files that are older than 15 minutes in the directory.The directory is supplied as the parameter to the script.
please help with a sample script.

Thanks in advance
veera
  #2 (permalink)  
Old 08-05-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Please read the rules:
(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post where your goal is to get an answer more quickly.

I have closed the duplicate thread.
  #3 (permalink)  
Old 08-09-2005
98_1LE 98_1LE is offline Forum Advisor  
Registered User
  
 

Join Date: Dec 2000
Location: Greater Dallas area
Posts: 405
This is cheesy, but meets the requirements (the right way would be to touch the file back 15 minutes)

Code:
#!/bin/bash

RCPT="username@domain.zzz" # This is who to mail the list to

touch /tmp/.adkojha

if [ "$1" = "" ]
   then echo "Usage: $0 /path/to/dir"
          exit 1
fi
cd $1

sleep 900
find . -newer /tmp/.adkojha | mail $RCPT
rm -f /tmp/.adkojha
Sorry it has been a long day
  #4 (permalink)  
Old 08-10-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Quote:
Originally Posted by 98_1LE
This is cheesy, but meets the requirements (the right way would be to touch the file back 15 minutes)

Code:
#!/bin/bash

RCPT="username@domain.zzz" # This is who to mail the list to

touch /tmp/.adkojha

if [ "$1" = "" ]
   then echo "Usage: $0 /path/to/dir"
          exit 1
fi
cd $1

sleep 900
find . -newer /tmp/.adkojha | mail $RCPT
rm -f /tmp/.adkojha
Sorry it has been a long day

A question. Why use a touch and then a rm.

find has -amin and -mmin option. That can be used as well.

Is there any reason as such, that these do not serve the purpose ?

Vino
  #5 (permalink)  
Old 08-10-2005
sveera sveera is offline
Registered User
  
 

Join Date: Mar 2005
Location: INDIA
Posts: 60
Talking files older than 15 minutes

Hi Friends,

Thanks a lot for your response.yes i can always use find with amin and mmin.

And the reply given by 98 1 LE is also helpful.
Once again thank you friends
Bye
veera
  #6 (permalink)  
Old 08-10-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Quote:
Originally Posted by vino
A question. Why use a touch and then a rm.

find has -amin and -mmin option. That can be used as well.

Is there any reason as such, that these do not serve the purpose ?

Vino
vino, amin and mmin are not standard. GNU added them to their version of find which Linux uses. They will not work with the standard find command.
  #7 (permalink)  
Old 08-10-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Perderabo,
Thanks much.

vino
Closed Thread

Bookmarks

Tags
linux, mtime

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 07:04 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