首页 > 服务器 > 管理维护 > 正文

ntp同步时间脚本

2020-10-03 17:57:21
字体:
来源:转载
供稿:网友

1. 登录机器使用date命令查看。

2. 执行如下命令:

#echo -e "0.asia.pool.ntp.org/n1.asia.pool.ntp.org/n2.asia.pool.ntp.org/n3.asia.pool.ntp.org/n210.72.145.44">/etc/ntp/step-tickers
#ntpdate -u 0.asia.pool.ntp.org 
#echo -e "server 0.asia.pool.ntp.org prefer/nserver 1.asia.pool.ntp.org/nserver 2.asia.pool.ntp.org/nserver 3.asia.pool.ntp.org/nserver 210.72.145.44">>/etc/ntp.conf
#service ntpd start
#chkconfig --level 35 ntpd on

3. 使用date查看时间是否已经同步到国家标准授时时间

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表