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

Linux date time setting synchronization command sharing

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Date command:

# date

Display system time

Hwclock command (that is, hardwareclock system hardware time)

# hwclock

Display hardware time

# hwclock-w

Write the system time to the system hardware

Ntpdate

Ntpdate is a linux time synchronization service software, specific details, please refer to Baidu, there are a lot of detailed information

Check to see if the ntpdate service is installed on this machine, and if not, yum install-y ntpdate

Synchronization time

Enter ntpdate time.nist.gov synchronization network time

Results: 3 Jun 15:42:39 ntpdate [4721]: adjust time server 211.115.194.21 offset-0.005885 sec

The above results indicate that the time synchronization is successful. The above roughly means that the adjustment time is the time of server 211.115.194.21, with a difference of-0.005885 seconds.

If the above time.nist.gov server cannot be synchronized, you can try the following time servers:

Time.nist.gov

Time.nuri.net

0.asia.pool.ntp.org

1.asia.pool.ntp.org

2.asia.pool.ntp.org

3.asia.pool.ntp.org

Adjust hardware time after synchronization time is successful

# hwclock-w

After the execution is successful, check the system hardware time (if nothing happens, the real time of both date and hwclock is internet time)

# date

# hwclock

When executing the above command, the display time should be the same

Time synchronization tasks are executed regularly, so we use crontab-e to add timing tasks

/ 1 ntpdate time.nuri.net;hwclock-w

That is: # synchronize the internet time every other hour and write to the hardware

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