TA的每日心情 | 开心 2023-8-9 11:05 |
---|
|
ConfigurationOrdinarily, ntpd reads the ntp.conf configuration file at startup time in order to determine the synchronization sources and operating modes. It is also possible to specify a working, although limited, configuration entirely on the command line, obviating the need for a configuration file.
Usually, the configuration file is installed in the /etc directory, but could be installed elsewhere (see the -c conffile command line option). The file format is similar to other Unix configuration files - comments begin with a # character and extend to the end of the line; blank lines are ignored.
The default ntp.conf file like this:
restrict default nomodify notrap noquery
restrict 127.0.0.1
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
keys /etc/ntp/keys
In addition, ntpd daemon can be run with various options. In order to add command line options to the ntpd service (/etc/init.d/ntpd), one has to edit /etc/sysconfig/ntpd file and add the desired option to the OPTIONS variable, and restart the service via 'service ntpd restart'.
For example, the -x argument is mandatory for RAC configurations and the /etc/sysconfig/ntpd file looks as:
# Drop root to id 'ntp:ntp' by default.
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
# Set to 'yes' to sync hw clock after successful ntpdate
SYNC_HWCLOCK=no
# Additional options for ntpdate
NTPDATE_OPTIONS=""
You can check the settings from that /etc/sysconfig/ntpd file but it will not be reliable if the ntpd process is started manually for some reason. To check the arguments you can use command line:
# ps -o args -p `cat /var/run/ntpd.pid`
COMMAND
ntpd -x -u ntp:ntp -p /var/run/ntpd.pid
#
|
|