On Wednesday, June 28, 2023 5:05:25 P.M. AEST Neil Bothwick wrote:
> On Tue, 27 Jun 2023 18:49:55 -0600, [email protected] wrote:
> > # Query the API to get the current IP address
> > NEW_IP=$(get_ip_address)
> >
> > # Retry if the IP address is empty
> > retry_count=0
> > while [[ -z "$NEW_IP" && $retry_count -lt 3 ]]; do
> >
> > sleep 1
> > NEW_IP=$(get_ip_address)
> > ((retry_count++))
> >
> > done
>
> That's better, although I would use a longer sleep to allow for network
> issues.
# Retry if the IP address is empty
retry_count=0
while [[ -z "$NEW_IP" && $retry_count -lt 3 ]]; do
((retry_count++))
sleep $retry_count
NEW_IP=$(get_ip_address)
done
--
Reverend Paul Colquhoun, ULC. http://andor.dropbear.id.au/
Asking for technical help in newsgroups? Read this first:
http://catb.org/~esr/faqs/smart-questions.html#intro