linux时间同步

时间同步:

***************************************************************

rdate(receive date)

功能说明:显示其他主机的日期与时间。

  法:
rdate [-ps][主机名称或IP地址...]

补充说明:执行rdate指令,向其他主机询问系统时间并显示出来。

  数:
 -p 
显示远端主机的日期与时间。
 -s 
把从远端主机收到的日期和时间,回存到本地主机的系统时间。

*****************************************************************

 

在节点2上:

[root@node2 ~]# vi /rdate

[root@node2 ~]# cat /rdate

rdate -s 192.168.100.101

[root@node2 ~]# chmod 755/rdate

[root@node2 ~]# crontab -e

添加下面内容:

*/1 * * * * /rdate                         #每分钟同步一次

如果时间不能同步,执行下面命令。

[root@node2 /]# chkconfigdaytime-dgram on

[root@node2 /]# chkconfigdaytime-stream on

[root@node2 /]# chkconfigtime-stream on

[root@node2 /]# chkconfigtime-dgram on

重启服务:

[root@node2 /]# servicexinetd restart

Stopping xinetd:                                          [  OK  ]

Starting xinetd:                                          [  OK  ]

查看状态:

[root@node2 /]# chkconfig--list | grep time

        daytime-dgram:  on

        daytime-stream: on

        time-dgram:     on

        time-stream:    on

设置完成,建议重启节点2.

 

posted on 2013-11-21 16:45  vlen  阅读(178)  评论(0编辑  收藏  举报