Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

There will be problems when the clock is out of sync in liunx system.

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "there will be problems when the clock is not synchronized under the liunx system". The explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "there will be problems when the clock is not synchronized under the liunx system" together.

Linux system clock is used in many places, if not, there will be some strange problems;

In Linux, the main commands for clock viewing and setting are date, hwclock, and clock. Linux clock is divided into system clock (System Clock) and hardware clock (Real Time Clock). System clock: refers to the clock in the current Linux Kernel, hardware clock: is the clock on the motherboard powered by batteries, this hardware clock can be set in the BIOS.

When Linux boots, the hardware clock reads the system clock settings, and the system clock operates independently of the hardware.

All commands in Linux, including functions, are set using the system clock of. In Linux, the main commands for clock viewing and setting are date, hwclock, and clock. Among them, clock and hwclock usage is similar, only one on the line, but the clock command in addition to support x86 hardware system, but also support Alpha hardware system.

1、 date

View system time

# date

set the system time

# date-set "07/07/06 10:19″ //(MM/DD/YYY: MM: SS)

2、hwclock/clock

View hardware time

# hwclock-show //or

# clock –show

Set hardware time

# hwclock-set-date="07/07/06 10:19″ or

# clock-set-date="07/07/06 10:19″ (MM/DD/YYYY: MM: SS)

Synchronization of hardware time and system time

According to the previous statement, restart the system, hardware time will read the system time, achieve synchronization,

However, when not restarting, synchronization needs to be achieved with the hwclock or clock command.

Hardware clock synchronization with system clock:

# hwclock-hctosys // (hc for hardware time, sys for system time) or

# clock –hctosys

System clock and hardware clock synchronization:

# hwclock-systohc //or

# clock –systohc

4. Synchronization with external NTP time servers

$ service ntpd stop

This step is necessary, otherwise it appears:

25 Nov 18:10:34 ntpdate[2106]: the NTP socket is in use, exiting

Failure tips;

$ ntpdate ntp.sjtu.edu.cn

Normal returns are as follows:

25 Nov 18:14:34 ntpdate[2164]: adjust time server 202.120.2.101 offset -0.006107 sec

Error returns such as:

25 Nov 18:13:44 ntpdate[2158]: no server suitable for synchronization found

$ service ntpd start

$ chkconfig ntpd on

$ clock -w

It can also be written into timed tasks to synchronize timed clocks:

$ crontab -e

05 * * * * /usr/sbin/ntpdate ntp.sjtu.edu.cn > /dev/null 2>&1

05 17 * * * /sbin/clock -w

Please attach the approximate NTP server address available in China

server 133.100.11.8 prefer

server 210.72.145.44

server 203.117.180.36

server 131.107.1.10

server time.asia.apple.com

server 64.236.96.53

server 130.149.17.21

server 66.92.68.246

server www.freebsd.org

server 18.145.0.30

server clock.via.net

server 137.92.140.80

server 133.100.9.2

server 128.118.46.3

server ntp.nasa.gov

server 129.7.1.66

server ntp-sop.inria.frserver 210.72.145.44 (IP address of China National Time Service Center server)

server ntp.sjtu.edu.cn (Shanghai Jiaotong University Network Center NTP server address)

Thank you for reading, the above is the content of "liunx system clock synchronization will occur problems", after the study of this article, I believe that we have a deeper understanding of the problem of liunx system clock synchronization, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report