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 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
File System Check using shell script !!! csaha Shell Programming and Scripting 8 03-17-2009 08:23 AM
Script to check and report database file sizes... marconi Shell Programming and Scripting 2 04-02-2008 05:50 AM
Need Script to check file exist and compare rbknisely UNIX for Dummies Questions & Answers 1 01-16-2008 01:08 AM
script to check for a condition inside a file kiran1112 Shell Programming and Scripting 11 03-21-2007 09:38 AM
file date check script jaxconsultant UNIX for Dummies Questions & Answers 4 10-10-2001 03:23 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-15-2005
mmarsh mmarsh is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 6
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.
  #2 (permalink)  
Old 09-15-2005
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
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
  #3 (permalink)  
Old 09-16-2005
mmarsh mmarsh is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 6
Thanks !!!!!
Sponsored Links
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 08:52 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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