The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to check and report database file sizes... marconi Shell Programming and Scripting 2 04-02-2008 02:50 AM
Need Script to check file exist and compare rbknisely UNIX for Dummies Questions & Answers 1 01-15-2008 09:08 PM
script to check for a condition inside a file kiran1112 Shell Programming and Scripting 11 03-21-2007 05:38 AM
File System Check using shell script !!! csaha Shell Programming and Scripting 7 01-03-2006 12:36 AM
file date check script jaxconsultant UNIX for Dummies Questions & Answers 4 10-10-2001 12:23 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-15-2005
Registered User
 

Join Date: Sep 2005
Posts: 6
Stumble this Post!
Script to check for a file, check for 2hrs. then quit

I wish to seach a Dir for a specific file, once the file is found i will perform additional logic. If the file is not found within two hours, i would like to exit.

Logically, I'm looking for the best way to approach this

Thanks for any assistance in advance.

Note: I'm using a C shell and have a little exp with awk,sed and grep.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 09-15-2005
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Stumble this Post!
Code:
#!/bin/csh -f
set now = 0
# set up any other variables
#
#================================
loop:
if (! -e "/tmp/myfile") then
 sleep 120 # wait 2 minutes
 @ now = $now +2
  if ($now > 120) goto files-missing # Waited two hours - giving up
  goto loop
endif
# Put what to do if you found the file here
# and then go to the end to exit
goto end-it-all
#===================
files-missing:
# You might want to send yourself an email that it didn't get the file
# or just drop through to end-it-all
end-it-all:
exit
Reply With Quote
  #3 (permalink)  
Old 09-16-2005
Registered User
 

Join Date: Sep 2005
Posts: 6
Stumble this Post!
Thanks !!!!!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:34 PM.


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

Content Relevant URLs by vBSEO 3.2.0