[Novalug] Infinite loop in init script on embedded linux -- hopeless?

Ed James edward.james@gmail.com
Tue Apr 24 09:44:10 EDT 2012


I perhaps mis-read the problem as the script being stored on flash
somewhere as meaning it wasn't available to being re-written, so a
script re-write couldn't be implemented.  However, props for a pretty nifty
fail-safe feature in general.

Ed James

On 4/24/12, Jason Kohles <jkohles@palantir.com> wrote:
> If it waits there forever, then I would guess that the script is running
> before the network is initialized.  Embedded systems are often stripped
> down, but I can confirm that this technique will work on a regular system,
> as long as the script is running after the network is initialized (I.e. on a
> CentOS/RHEL/Fedora machine it has to run after S10network).
>
> The easiest way to timeout after the script has run for "too long" is just
> to keep a counter that counts down and escapes if it runs out..
>
> #!/bin/sh
> counter=100
> while [ $counter -gt 0 ]; do
>     sleep 3
>     ifconfig eth0 && break
>     let counter--
> done
>...



More information about the Novalug mailing list