Sujet : Re: Delaying Autostart
De : jornws200602 (at) *nospam* xs4all.nl (Oscar)
Groupes : comp.sys.raspberry-piDate : 03. Jun 2025, 14:00:54
Autres entêtes
Organisation : A butterfly in Tokio
Message-ID : <101mrm6$sht$1@dont-email.me>
References : 1 2
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <
101itmk$2mr8t$1@dont-email.me>,
Lawrence D'Oliveiro <
ldo@nz.invalid> wrote:
Instead of waiting for some fixed interval, you could add a prior command
using wget or something to repeatedly try accessing that URL, say at 5
second intervals or whatever, until it becomes accessible, before allowing
the startup to proceed.
For inspiration, I made a script to 'etherwake' a device and wait for it
to get ready using wget in combination with the 'timeout' command. I run
'timeout 1 wget <url>' which returns an error if wget does not respond
in 1 second, or wget returns an error itself. I use this in a while
loop that repeats this until the wget succeeds:
etherwake -D -i ${IFACE} ${MACADDR}
while ! timeout 1 curl --noproxy \* "${URL}" &> /dev/null
do
echo -n .
sleep 1
done
The OP could replace the 'sleep 120' in the other script with this loop.
-- [J|O|R] <- .signature.gz