Linux下ntp自动更新服务器时间

首先安装ntp,而后使用命令  /usr/sbin/ntpdate ntp.api.bz 更新时间能够将以上命令加入crontab中定时执行;

但每每咱们会在执行ntpdate命令时失败,解决方法以下:


#/usr/sbin/ntpdate pool.ntp.org
Name server cannot be used, exiting27 Nov 23:41:32 ntpdate[3612]: name server cannot be used, reason: Temporary failure in name resolution

解决方法:设置DNS服务器
#echo "nameserver 8.8.8.8" 〉 /etc/resolv.conf    根据本身实际环境修改 #ntpdate pool.ntp.org 27 Nov 23:47:40 ntpdate[4145]: adjust time server 202.112.31.197 offset -0.481976 sec # /etc/init.d/ntpd start 正在启动 ntpd:                                            [肯定]
相关文章
相关标签/搜索