国际地球自转学会近日表示,由于地球自转放缓的原因,2015年6月30日将迎来史上第26次闰秒,科学家们将再度给钟表额外增加1秒钟时间,届时原子钟将会在23点59分59秒后停留一秒钟,让变慢的地球自转跟上原子钟步伐。

对于已经打开NTP服务并且接入了外部时钟源的系统服务器,当闰秒来临时,Linux内核处理闰秒的代码部分因存在Bug, 从而将会导致系统挂死。所以,需要在闰秒时间到来之前至少24小时停止服务器操作系统的NTP服务,闰秒时间之后24小时开启该NTP服务来规避此问题。

为方便操作,如果系统内部有NTP Server,统一停系统内的NTP Server即可。

1、闰秒来临时间为格林威治时间6月30日23:59:59,中国闰秒时间为北京时间7月1日7:59:59。其他各地区时间以格林威治时间为参考自行计算。要求在格林威治时间6月29日23:59:59前完成执行。

2、进行操作系统NTP服务的关闭和启停,不影响服务器的运行

3. 、有操作均以root用户执行。

确认所有主机配置的时钟源

如果是系统内部源IP,则停NTP Server即可。

如果是外部源IP,可以跟局方商量停外部源,或者停内部机器的NTP。

查询时钟源

如果运行了NTP服务,查询结果如下,则需要执行。


# ntpq -p
    remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 LOCAL(0)        .LOCL.          10 l   19   64  377    0.000    0.000   0.001
*132.96.252.12  .GPS.            1 u   46   64  377    0.973    0.114   0.408


如果没有运行NTP服务,查询结果如下,则不需要执行

# ntpq -p
 
ntpq: read: Connection refused

AIX系统操作步骤


使用lssrc -ls xntpd命令检测xntpd 的运行状态,确认启用了ntpd服务


#lssrc -ls xntpd
Program name:   /usr/sbin/xntpd 
 Version:         3
 Leap indicator:  11 (Leap indicator is insane.)
 Sys peer:        no peer, system is insane
 Sys stratum:     16
 Sys precision:   -17
 Debug/Tracing:   DISABLED
 Root distance:   0.000000
 Root dispersion: 0.000000
 Reference ID:    no refid, system is insane
 Reference time:  no reftime, system is insane
 Broadcast delay: 0.003906 (sec)
 Auth delay:      0.000122 (sec)
 System flags:    bclient pll monitor filegen 
 System uptime:   6 (sec)
 Clock stability: 0.000000 (sec)
 Clock frequency: 0.000000 (sec)
 Peer: 127.127.1.0
     flags: (configured)(refclock)(preferred) 
     stratum:  3, version: 3 
 
Subsystem        Group            PID          Status 
 xntpd            tcpip            5767608      active


如果查询显示ntp服务为active,则继续下面的操作,如果查询不到NTP进程,则中止通知单的执行。

2、在闰秒时间到来之前24小时执行如下命令停止ntpd服务

# stopsrc -s xntpd
0513-044 The /usr/sbin/xntpd Subsystem was requested to stop.


3、停止后使用命令lssrc -ls xntpd确认ntp服务已经停了。


# lssrc -ls xntpd
0513-036 The request could not be passed to the xntpd subsystem.
Start the subsystem and try your command again.
HPUX系统操作步骤

使用ps –ef |grep ntp命令检测xntpd的运行状态,确认启用了ntpd服务


root@ocs1: >ps -ef|grep ntp
root 28144 26805 0 10:50:59 pts/ta 0:00 grep ntp
root 27216 1 0 10:06:17 ? 0:00 /usr/sbin/xntpd


如果查询有进程,则继续下面的操作,如果查询不到NTP进程,则中止通知单的执行。

2、在闰秒时间到来之前24小时执行如下命令停止ntpd服务



# /sbin/init.d/xntpd stop
0513-044 The /usr/sbin/xntpd Subsystem was requested to stop.



3、停止后使用命令ps –ef |grep ntp确认ntp服务已经停了。



root@ocs1: >ps -ef|grep ntp
root 28144 26805 0 10:50:59 pts/ta 0:00 grep ntp


Solaris系统操作步骤



如果是普通的SUN主机,NTP用的是ntp.conf

先查一下,是用的什么NTP:svcs –a|grep ntp


online表示当前用的ntp4

2、在闰秒时间到来之前24小时执行如下命令停止ntpd服务



如果上面是ntp,则执行

#svcadm disable svc:/network/ntp:default

如果上面是ntp4,则执行

#svcadm disable svc:/network/ntp4:default



3、停止后使用命令检查,如果显示offline则没启动



# svcs –a|grep ntp



如果是配置的suncluster,使用的是ntp.conf.cluster

 

1,在闰秒时间到来之前24小时执行如下命令停止ntpd服务



# root@ocs1# /etc/rc2.d/S74xntpd.cluster stop


   2,查询结果ntpq -p

Redhat系统操作步骤

1、执行命令service ntpd status,确认启用了ntpd服务,示例如下:



# service ntpd status
ntpd (pid 2651) is running...



如果查询显示ntp服务为running,则继续下面的操作,如果ntp服务为stopped,则中止通知单的执行。

2、执行如下命令停止ntpd服务

#service ntpd stop
Shutting down ntpd: [ OK  ]

SuSE系统操作步骤



1、执行命令/etc/init.d/ntp status,确认启用了ntpd服务,示例如下:



# /etc/init.d/ntp status
    remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 LOCAL(0)        .LOCL.          10 l   24   64    1    0.000    0.000   0.001
*132.96.252.12  .GPS.            1 u    7   64    1    0.770   -0.013   0.016
Checking for network time protocol daemon (NTPD):                              running



如果查询显示ntp服务为running,则继续下面的操作,如果ntp服务为unused,则中止通知单的执行。

2、在闰秒时间到来之前24小时执行如下命令停止ntpd服务



#/etc/init.d/ntp stop
Shutting down network time protocol daemon (NTPD)



3、停止后使用命令/etc/init.d/ntp status确认ntpd服务为unused。


#/etc/init.d/ntp status
Checking for network time protocol daemon (NTPD):                                 unused