![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| looking for help with a dd loop check script | angusyoung | Shell Programming and Scripting | 1 | 06-24-2008 07:51 AM |
| script to loop and check jumping seq. | happyv | Shell Programming and Scripting | 1 | 10-05-2006 10:55 AM |
| maximum number of times - a file can be opened | matrixmadhan | High Level Programming | 3 | 03-21-2006 11:24 AM |
| Counting Number of times a File is accessed | pathanjalireddy | Shell Programming and Scripting | 1 | 04-11-2005 10:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Loop to check for file up to 3 times
Please forgive this I think rather basic question.
I have been away from UNIX for a very long time and am in need of some help. I need to be able to check for the existance of a specific file name say 'file.dat' in a particular location If the file exists then run a second process (at processname now) If the file does not exist then sleep 5 minutes and look for it again for up to 3 times Once the file has been found and processed once only then send a mail and finish Any hints tips or specific examples would be appreciated Running HPUX by the way Thanks |
|
||||
|
Many thanks for your help.
I have made some progress using the code, but need some further help with the following 1 The process searches up to 3 times for the arival of a file. Once it has detected the file and processed the job , it is important that it does not do so again. How can I prevent this? 2 In this version of the code the script does not loop back to try again when the file is not found #!/bin/ksh file="/path/to/file/file.dat" for i in 1 2 3 do if [[ -f $file ]] ; then echo " file found" at -f jtest_get_file.sh now else echo "File not found!". break fi sleep 3 # 3 seconds will be 600 done Regards |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|