运维联盟俱乐部

 找回密码
 立即注册
查看: 1577|回复: 0

[日常管理] ntpd

[复制链接]
  • TA的每日心情
    开心
    2023-8-9 11:05
  • 发表于 2021-9-22 10:10:27 | 显示全部楼层 |阅读模式
    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
    #


    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    运维联盟俱乐部 ( 冀ICP备19036648号 )

    GMT+8, 2024-5-17 14:08 , Processed in 0.046922 second(s), 21 queries , Gzip On.

    Powered by Discuz! X3.4

    © 2001-2023 Discuz! Team.

    快速回复 返回顶部 返回列表