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

How to use ntp command to realize time synchronization in linux

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

Share

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

This article introduces how to use ntp command to achieve time synchronization in linux. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

If the time of the server is confused, it will lead to a lot of unexpected problems. Using NTP, you can get the server to get the right time, thus avoiding problems.

NTP is the abbreviation of Network Time Protocol, which means "Network time Protocol". It is a time synchronization protocol implemented by TCP/IP protocol.

Ubuntu automatically goes to ntp.ubuntu.com to do time synchronization every time it starts. However, since the server generally does not start frequently, the time deviation cannot be avoided, and this deviation can be large. Therefore, we need to correct the server's time from time to time. The most convenient way is to synchronize time once a day with the help of cron's scheduled tasks. For example, create a file / etc/cron.daily/timeupdate:

_ FCKpd___0nbsp;sudo nano / etc/cron.daily/timeupdate

Then enter the following:

Ntpdate ntp.ubuntu.com

After you save the file, you also need to give it executable permissions:

_ FCKpd___2nbsp;sudo chmod 755 / etc/cron.daily/timeupdate

In this way, the system can go to ntp.ubuntu.com every day to get the time (all tasks in the / etc/cron.daily/ directory are executed once a day) and calibrate the time of the server itself. If you are worried about the failure of time acquisition, you can add multiple NTP servers to the / etc/cron.daily/timeupdate file:

Ntpdate ntp.ubuntu.com pool.ntp.org on how to use ntp commands in linux to achieve time synchronization function is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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