Ntpd config file support

Harald Becker ralda at gmx.de
Tue Mar 18 18:31:21 UTC 2014


Hi Bryan !

On 18-03-2014 18:02 Bryan Evenson <bevenson at melinkcorp.com> wrote:

>Harald had suggested an example startup script (I'm assuming
>under the examples/ directory of the Busybox source?).  With a
>working example and an easy place to find the ntpd command line
>options, I'd probably give the Busybox-provided ntpd a try.

Have you ever tried "busybox ntpd --help"? If Busybox has bean
compiled with full usage messages (the default) this shall give
you all necessary info about ntpd command line options:

from my 1.19.0 version this gives: (may have changes on newer
versions)

Usage: ntpd [-dnqNw] [-S PROG] [-p PEER]...

NTP client/server

Options:
	-d	Verbose
	-n	Do not daemonize
	-q	Quit after clock is set
	-N	Run at high priority
	-w	Do not set time (only query peers), implies -n
	-S PROG	Run PROG after stepping time, stratum
                change, and every 11 mins
        -p PEER	Obtain time from PEER (may be repeated)


So normal Daemon startup is just:

ntpd -p PEERADDRESS


A (very) simple script solution:

ntpd -p `cat /etc/timeserver`

This however does not check for parameter mistakes, but with some
awk or sed scripting you can parse and check your config file and
even allow for multiple time server specification (adding extra
-p options).


All that without increasing Busybox binary size, which would give
us no extra functionality (when just reading config file on ntpd
startup).

--
Harald


More information about the busybox mailing list