centos时间同步

采用crontab的方法如下:

#检查dns是否设置

cat /etc/resolv.conf

#如果未设置,在文件尾部添加dns,示例

nameserver 192.168.0.1

#设置每天1点0分执行

vi /etc/crontab

0 1 * * *     ntpdate ntpdate us.pool.ntp.org > /dev/null 2>&1

如果提示:ntpdate: command not found,说明ntpdate没有安装,可以在线安装:yum install ntp

发布了46 篇原创文章 · 获赞 5 · 访问量 8万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章