CentOS時間同步

CentOS時間同步

安裝ntpdate

[root@node-01 ~]# yum install ntpdate -y
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.zju.edu.cn
 * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package ntpdate.x86_64 0:4.2.6p5-10.el6.centos.2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================================
 Package                    Arch                      Version                                     Repository               Size
================================================================================================================================
Installing:
 ntpdate                    x86_64                    4.2.6p5-10.el6.centos.2                     base                     78 k
Transaction Summary
================================================================================================================================
Install       1 Package(s)
Total download size: 78 k
Installed size: 123 k
Downloading Packages:
ntpdate-4.2.6p5-10.el6.centos.2.x86_64.rpm                                                               |  78 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ntpdate-4.2.6p5-10.el6.centos.2.x86_64                                                                       1/1 
  Verifying  : ntpdate-4.2.6p5-10.el6.centos.2.x86_64                                                                       1/1 
Installed:
  ntpdate.x86_64 0:4.2.6p5-10.el6.centos.2                                                                                      
Complete!

同步時間

[root@node-01 ~]# /usr/sbin/ntpdate cn.pool.ntp.org
27 Jul 15:24:41 ntpdate[1674]: step time server 85.199.214.101 offset -27705.095972 sec

加到定時任務中

[root@node-01 ~]# crontab -e
[root@node-01 ~]# crontab -l
# time sync
*/5 * * * * /usr/sbin/ntpdate cn.pool.ntp.org >/dev/null 2>$1
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章