ntp - the LCFG NTP component
This component constructs all the necessary configuration files and starts the ntp time daemon.
The component implements two main methods: configure and run.
The configure method starts, stops and configures the ntpd daemon as controlled by the mode resource. If this is set to "daemon" then the method configures and starts the daemon when first called. Any other setting results in no daemon being started; in this case the run method can be used as a one-shot way to set the time (see below).
The behaviour of the configure method when called after the component is started is as follows: the current mode is compared against the saved mode from the last call to configure, and any change from daemon to no-daemon or no-daemon to daemon is made immediately. If the current and previous mode are both "daemon" then by default no action is taken. This is to preserve time stability across lcfg-header changes, and is a deliberate design decision.
If it is really desired that a configure should always be acted on immediately, there are a couple of ways in which this can be set. The first is to call the configure method with the "force" parameter; and the second is to set the auto_configure resource. If either of these is done then a new ntp.conf file is always generated and the daemon is always stopped and restarted. Note that there is no corresponding "noforce" configure parameter to undo the effect of setting auto_configure.
The run method will run ntpdate and set the hardware clock, provided that the mode resource was not set to "daemon" and so no daemon was started. This is useful on laptops, where a network connection may be unavailable or it may be undesirable to bring one up.
stop, suspend and resume are implemented as wrappers round configure.
The component offers the following extension to the status method: if the parameter "clocks" is specified then information pertaining to the currently-selected kernel clock is printed. The default is to print the usual status information.
This resource should be set to "daemon" to enable the ntp daemon. It would normally be set to this on permanently connected machines and not set on normally disconnected machines (e.g. laptops). If no daemon is started then the component's run method can be used to resynchronise the machine's clock. (The run_daemon resource is still available for backward compatibility, but offers a less fine level of control.)
As a deliberate design decision to improve time stability when a header file change could potentially affect many timeservers, the component does not adjust the running configuration by default when resources are altered. If automatic reconfiguration really is required, set this resource.
A (space-separated) list of NTP servers.
A (space-separated) list of NTP peers.
Access restrictions to apply. restrict_default specifies what the global default is. restrict_policy allows for separate site-specific restrictions to be applied. restrict_localhost specifies what restrictions to apply to other things running on the machine itself. The component itself will inject its own appropriate restrictions for any configured servers and peers.
NOTE: if you don't specify a value for restrict_default and restrict_localhost then those restrictions are turned off. If no value is specified for restrict_policy then no restriction or unrestriction statement is generated in the daemon configuration.
These two set the minpoll and maxpoll values for all the configured servers and peers. See the documentation in the ntp distribution for full details. The daemon will operate quite happily without these being set, so if in doubt leave them alone.
servers and peers and their associated "restrict" and "poll" resources don't allow for much in the way of control of the options applied to each entry in the lists. As an alternative, serversPeers defines a tag-list, with individual fields as below. Note that you can't mix and match servers, peers and serversPeers. If you set serversPeers then any values of peers and servers will be ignored.
The name or IP address of the server or peer. This must be specified.
Set this to peer with name_.... The default is to use name_... as a server.
If set, is added as a comment in the generated configuration file.
Use NTP version version_.... If not set, allow the daemon to choose.
Set the "prefer" option.
Set server/peer-specific "restrict" options.
Set the poll values.
Set the autokey option.
Set the key value to the resource's value.
Set the burst options.
Set the true option. Note the caveat in the ntpd documentation.
These all set various fudge options.
This resource does not actually affect the operation of the component, but instead is included in some of its messages. Setting it to some lcfg context-specific value might therefore be useful to the user.
The name of the daemon's (generated) configuration file.
The name of the daemon's drift file.
The name of the file into which the daemon should write its pid.
The name of the daemon program.
Additional command-line flags to pass to the daemon.
The name of the ntpdate program.
The name of the tickadj program.
Should the component attempt to raise the daemon's priority, so that other processes interfere less with timekeeping?
Should the daemon do any logging? The value of this resource should be a list of valid logconfig keywords. If it's not set then no logging is done. See the standard NTP web documentation for details of what's required here.
Should the daemon collect statistics? statistics says which we should collect, if any. statsdir says where they should go. filegen_thing which says how that particular statistic is to be handled. See the standard NTP web documentation for details of what's required here.
Should the daemon keep track of protocol requests, to be queried using ntpq's monlist command?
Some refclocks may need symlinks from device names to conventional names. This tag-list allows such links to be set up. The associated list items are devName_..., devOwner_..., devGroup_..., devMode_..., devLink_..., devLabel_... and devSetSerial_....
Some refclocks may require auxilliary daemons to be started. This tag-list defines such daemons. The associated list items are adDaemon_..., adFlags_..., adUser_..., adLabel_... and adRunAfter_.... By default, auxilliary daemons are started before the main ntpd daemon.
By default the component just accepts whatever clock source the kernel happens to have chosen. If this isn't desired, clockPreferences can be used to specify a list of preferred clock sources. The first one which matches something in the kernel's available_clocksource list will be written to the current_clocksource. If nothing matches, the existing clock source will be kept.
Extra command-line flags to pass to the hardware-clock tools.
A helper program used by the component itself. Do not set this resource unless you know what you're doing.
Redhat and Fedora versions from RedHat 7 onwards, though options set by the component must of course be supported by the corresponding installed daemon. Last tested on SL5 and Fedora 13.