NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: rc.local nightmare



Ramiro Aceves <ea1abz%gmail.com@localhost> writes:

> Hi all,
>

[snip]

> The script works fine if I run manually:
>
> #/root/nettest
>
>
> or even If I do this it works fine:
>
> #service local restart
>
> But If I reboot the machine the script starts during booting but I dies 
> very soon.
>
> I do not understand what is happening here. I know that the proper way 
> is writing a rc.d service but I am just curious to know the reason.
>
> Thanks so much.
> Regards.
>
> Ramiro.




The NIC on the RPI can take a while to actually come available depending
on what it is connected to.  This seems to be especially true if dhcp is
being used.  What may be happening is that the network isn't available
yet when rc.local runs and your scripts thinks it can't get anywhere.  I
noticed this because /etc/rc.d/ntpdate wasn't setting the date and time
because the device couldn't get anywhere (yet).  I dealt with this by
adding some sleep to /etc/rc.d/ntpdate to slow the boot down a bit and
allow the NIC and network to settle.  You may want to do something
simular.... another method to consider is to keep some more state around
for your script and only allow it to do the reboot check if it had
succeeded in getting out on the network once.



-- 
Brad Spencer - brad%anduin.eldar.org@localhost - KC8VKS - http://anduin.eldar.org



Home | Main Index | Thread Index | Old Index