Deutsch   English   Français   Italiano  
<101mrm6$sht$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: jornws200602@xs4all.nl (Oscar)
Newsgroups: comp.sys.raspberry-pi
Subject: Re: Delaying Autostart
Date: Tue, 3 Jun 2025 13:00:54 -0000 (UTC)
Organization: A butterfly in Tokio
Lines: 24
Message-ID: <101mrm6$sht$1@dont-email.me>
References: <101gqp3$1ro0p$1@dont-email.me> <101itmk$2mr8t$1@dont-email.me>
Injection-Date: Tue, 03 Jun 2025 15:00:55 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="8ff19d365287b3fc23bf0aa89b95448e";
	logging-data="29245"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19fwNQZvW+diyBbLpxOY1s7"
Cancel-Lock: sha1:NuhqLySf2XEX9FJtFRykp9Gbs+8=
X-Newsreader: 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