Hi
I am working with a piece of shell script which pings a server and waits for a response.
This has been proven to work.
In case of any network glitches I want to add error capturing.
Eg If the shell script returns an error, retry until it works without error.
I have tried the following but not sure if this is the correct / best way to do this.
try
do shell script "blah blah"
on error
repeat
do shell script "blah blah"
end repeat
end try
Yes, you need infinite loop (or finite repeat loop) but in another form:
repeat
try
do shell script "blah blah"
exit repeat
end try
end repeat
NOTE: makes sense adding some delay after end try code line. delay 1, or, delay 0.02, for example. In order not to bombard the server with too many requests. Also, it is better to put a finite number of repeat cycles (repeat 100 times, for example). In case the server is down at all for some reason, or, the server blocks pinning.