Best way to use dhcpc / avahi without delaying other init scripts ?

Avery Pennarun apenwarr at gmail.com
Tue Apr 30 18:28:19 UTC 2013


On Tue, Apr 30, 2013 at 2:24 PM, Mark Jackson <mpfj-list at newflow.co.uk> wrote:
> Ideally I'd like udhcpc to start up, try to get a lease and, if the
> lease request fails, use avahi to get a local ip address.
>
> I have this working, but the dhcp request can taken some time (or even
> fail if no dhcp server is present), and I am seeing delays of several
> seconds before my other init scripts run.  I have dual ethernet ports
> leading to about a 10seconf delay if no dhcp server is present.
>
> To prevent other init scripts from being delayed, udhcpc should
> instantly go into background mode (see [1]).

Maybe you just want to background the whole chunk of logic using an sh block?

(
   dhcpc -b ...
   ...if it failed to get an address from dhcp, do something else...
) &

Have fun,

Avery


More information about the busybox mailing list