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

Time synchronization date;hwclock-r

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

Share

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

1.

Date displays the system time

Date-s 10:10:10 set system time

When date-s "10:00:00 on 2018-8-8" sets the system time, if you still need to set a date, wrap the date and time values in double quotation marks

Hwclock or clock displays the hardware time. Time in BIOS on motherboard

A command to see the time date;hwclock-r

# hwclock-w writes the system time to the system hardware

Hwclock-s writes the hardware time to the system time:

two.

Stand-alone school time (can only be connected to the Internet)

Available network time servers:

Time.windows.com

Tock.stdtime.gov.tw

Ntp.api.bz

Ntpdate 0.cn.pool.ntp.org

Ntpdate ntp1.aliyun.com

Time synchronization, Linux system needs to install ntpdate

Check whether ntpdate: rpm-qa is installed | grep ntpdate

If not, run the following command: yum install ntpdate

Time synchronization method (server is rarely used):

[root@clent ~] # ntpdate time.windows.com or

[root@clent ~] # / usr/sbin/ntpdate time.windows.com

Crontab scheduling tasks

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

# / 1 * root ntpdatetime.nuri.net;hwclock-w

That is, synchronize the internet time every other hour.

Or

You can see the writing format of scheduled tasks through the vi / etc/crontab command

/ 5 / usr/sbin/ntpdate time.windows.com # synchronize every 5 minutes

Or

/ 5 ntpdate time.windows.com # synchronize every 5 minutes

Crontab-l: lists the contents of the current user's crontab file

Note:

Solve the the NTP socket is in use, exiting problem

[root@esx4 ~] # service ntpd stop

The system time is inconsistent with the hardware time (correct, but the system time is wrong). Hwclock-s writes the hardware time to the system time failure.

Hwclock-w {Save clock} solve the problem!

3. The server uses time to synchronize the server

4. Modify system time profile

[root@localhost ~] # / etc/sysconfig/clock

# Open the clock file and change the relevant content to the following content: UTC=true ARC=falseZONE= "Asia/Shanghai"

Restart the system

[root@localhost ~] # reboot

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