Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of using NTP to adjust system time when system time is out of order

Shulou Source: shulou.com Published: 2022-06-01 08:00:39 11月15日 Update

This article introduces the relevant knowledge of "the method of using NTP to adjust the system time when the system time is out of order". In the operation of the actual case, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

When we use the computer, we sometimes find that the time of the system is out of order. So how to make the system time accurate? Today, the editor will teach you a simple way to use NTP to adjust the system time.

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.

Solution:

1. Create a file / etc/cron.daily/timeupdate:

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

two。 Enter the following:

Ntpdate ntp.ubuntu.com

3. 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

This is the end of the content of "the method of using NTP to adjust the system time when the system time is out of order". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Time system method server service confusion adjustment content file synchronization task deviation more knowledge practical large frequent successful learning next dilemma Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MySQL Shulou Information Microsoft Shulou Tech Info