|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hi,
I have to create a shell script that will loop every 5minutes and will check if file.txt exists. If file.txt exists, it will call another shell script to execute. Kindly help me, what looping technique should i use. Thanx. ![]() |
|
#2
|
|||
|
|||
|
Using pseudocode:
Code:
while TRUE
do
check file status & do something if condition meet
sleep 360 seconds
done
|
|
#3
|
|||
|
|||
|
does this also apply in unix shell script?
Thanks |
|
#4
|
|||
|
|||
|
The potential trouble with fpmurphy's technique is that "something" might not consume the file. So we stay in the loop, sleep again, and do "something" again. This may be what is needed. Or we might want to do "something" just once:
Code:
while FILE DOES NOT EXIST
do
sleep 300
done
run second script
exit
And again this is psuedo-code to simply illustrate the looping technique. It applies to all languages incuding most shells. Specific syntax is not possible since there are many languages including several shells. |
|
#5
|
|||
|
|||
|
Thanx so much
|
|
#6
|
|||
|
|||
|
The potential trouble with perderabo's technique is that
it will run once (if the second does not (re)call the first script) is this the Q ? ![]() |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > loop script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|