ntpdate-like functionality in ntpd

Denys Vlasenko vda.linux at googlemail.com
Thu Feb 19 11:53:08 UTC 2015


On Wed, Feb 18, 2015 at 12:30 PM, Sven-Göran Bergh
<sgb-list+busybox at systemaxion.se> wrote:
>> 1. Run "something" such as ntpdate which sets an approximate time
>> quickly, but that also terminates quickly if there is no network
>> connectivity or NTP server does not respond
>> 2. As soon as this is done, launch ntpd and leave it running in the
>> background. If I am not wrong, Busybox's ntpd can be left running in
>> the background mostly unattended and will just do its stuff when the
>> network and NTP server is available.
>> 3. Then proceed with the rest of the initialisation.
>>
>> So far the missing part of the puzzle is 1 :-)
>
>
> As I understand it you are looking for q&d solution. In that case wouldn't
> just something like this do the trick?
>
> busybox timeout -t 2 busybox ntpd -nqp ....
>
> Without a server reply ntpdate will not save you anyway.

In fact this solution is not "dirty".

It does exactly what was asked for: it tries to set the time,
but aborts if this can't be done in alotted time.

And in the old Unix tradition, both parts of the task (syncing time
and aborting on timeout) are done with two separate tools.


More information about the busybox mailing list