linux命令中service ntpd restart,Linux OS Service 'ntpd' [ID 551704.1]

Ordinarily, 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

#

Files:

/etc/ntp/ntp.conf  - the default name of the configuration file

/var/lib/ntp/drift  - the default name of the drift file

/etc/ntp/keys      - the default name of the key file

/etc/sysconfig/ntpd  - setting command line options for ntpd daemon

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值