linux如何停止时间服务器,linux服务器系统时间同步设置方法

1.新装的服务器可能设置了错误的时区,需要调整时区并调整时间.

使用NTP来从一个时间服务器同步把当前时区调整为上海就是+8区(想改其他时区也可以去看看/usr/share/zoneinfo)目录;

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

2.检查是否安装ntp服务

rpm -qa ntp

[root@LAN8-KVM ~]# rpm -qa ntp

ntp-4.2.4p8-3.el6.centos.x86_64

若未安装ntp服务 yum安装一下(yum install ntp)

3.安装完了之后,测试一下(利用ntpdate同步标准时间)

[root@LAN8-KVM ~]#ntpdate 0.pool.ntp.org

29 Nov 03:44:15 ntpdate[28324]: the NTP socket is in use, exiting

这说明ntp服务正在使用,先停止ntp服务(service ntpd stop)在测试下

[root@LAN8-KVM ~]# ntpdate 0.pool.ntp.org

5 May 11:23:13 ntpdate[2056]: adjust time server 202.112.29.82 offset 0.000380 sec

如果出现上面的内容说明,同步成功了,然后开启ntp服务(servicentpd start)

4.修改时区(我这里以上海时区为主)

vi /etc/sysconfig/clock

ZONE="Asia/Shanghai"

5.加入定时计划任务

crontab –e

0 1 * * * /usr/sbin/ntpdate 0.pool.ntp.org

6.加入开机自启动

vi /etc/rc.local

ntpdate cn.pool.ntp.org

chkconfig ntpd on

推荐几个网络时间服务器地址

time.nist.gov(美国)

time.nuri.net

asia.pool.ntp.org

ntp.fudan.edu.cn (复旦)→国内用户推荐使用此服务器)

timekeeper.isi.edu

subitaneous.cpsc.ucalgary.ca

usno.pa-x.dec.com

time.twc.weather.com

swisstime.ethz.ch

ntp0.fau.de

ntp3.fau.de

time-a.nist.gov

time-b.nist.gov

time-nw.nist.gov

nist1-sj.glassey.com

210.72.145.44

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值