What's the easiest way to make Busybox keep correct time?
K.S.
skyscanner at gmx.ca
Mon Sep 1 19:29:19 UTC 2014
Harald Becker <ralda <at> gmx.de> writes:
>
> Try this one ...
>
> start() {
> echo -n "Starting ntpd: "
> /usr/sbin/ntpd -p north-america.pool.ntp.org && echo "OK" || echo
> "failed"
> }
Nope, and again it did something that when I tried to ssh in, it took a long
time (at least ten seconds) for the prompt to appear. Reverted to my
original and ntpd runs, and the prompt appears instantaneously when I ssh in.
> Are you sure your ntpd (a symlink to /bin/busybox) lives in /usr/sbin ?
# which ntpd
/usr/sbin/ntpd
I appreciate that you would like to know why this isn't working but I'm
really not too keen on rebooting the device several times a day when my
original script seems to be working fine. And what scares me more is the
delay in getting the prompt from a ssh session - my fear is that one time it
won't come up at all and then I am really screwed, since this is a
"headless" system, with no way to connect a display to see what is
happening. I appreciate your efforts but you're trying to fix something
that from my point of view, really isn't an issue, because there is no way
anyone will ever be able to read that output anyway. So whether it echoes
"ok" or "failed" is going to make absolutely no difference to anyone.
By the way, you mentioned adjtimex in another post, but then said "The usage
of *adjtimex* is difficult", and I'm already almost in over my head here.
The thing I am wondering is, when you run it does it make a change that
persists through reboots, or does it need to be run each time the system
comes up?
But more interesting to me is what I found on this page about adjtimex:
http://linuxcommand.org/man_pages/adjtimex8.html
Where it says:
For a machine connected to the Internet, or equipped with a precision
oscillator or radio clock, the best way is to regulate the system clock
with ntpd(8). The kernel will automatically update the hardware clock
every eleven minutes.
I have not been keeping a very close eye on the hardware clock since I
started running ntpd yesterday, and I just now checked it and it seems
pretty accurate (within 1 second), so maybe it is getting updated (I will
know more in a few hours). Further down it says:
There are several ways to estimate the drift rate. If your computer
can be connected to the net, you might run ntpd for at least several
hours and run "adjtimex --print" to learn what values of tick and freq
it settled on.
But that does not work in the Busybox version of adjtimex.
I am not too worried about the rare case where this system would not have
access to the internet for several days. While I grant that could happen,
it would be such a rare occurrence that I don't see it being an actual
problem, and I could always do a manual time setting (using the date
command) each day until the Internet comes back. However, I would like to
see the hardware clock remain reasonably accurate in case anything is
accessing that, so if it turns out that ntpd is not updating it as it should
then I will be looking for a way to run hwclock -w every hour or every few
hours, as mentioned in my previous reply to Isaac Dunham.
More information about the busybox
mailing list