In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to analyze the time management of the Linux system, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
3.3 system time Management 3.3.1 time Classification
There are two kinds of clocks in Linux, such as hardware clock and system clock.
The hardware clock refers to the clock device on the motherboard, that is, the clock that can usually be set on the BIOS screen.
The system clock refers to the clock in kernel; all Linux-related instructions and functions are set to read the system clock
When Linux starts, the system clock reads the setting of the hardware clock, and then the system clock operates independently
After setting the system time with the date command, the hardware clock will not be modified, so after the system restart, the system time will still read the hardware time, which is why the date setting fails.
3.3.2 hardware modification time
Command: clock/hwclock
Parameters:
-r,-- show reads and prints the hardware clock (read hardware clock and print result)
-s,-- hctosys synchronizes the hardware clock to the system clock (set the system time from the hardware clock)
-w,-- systohc synchronizes the system clock to the hardware clock (set the hardware clock to the current system time)
1. View the hardware clock
[root@pc6 ~] # hwclock-r
Tuesday, May 22, 2018, 10:43:48-0.079097 seconds
Clock is the same as hwclock
[root@pc6] # type-a clock
Clock is / sbin/clock
[root@pc6 ~] # ll / sbin/clock
Lrwxrwxrwx. 1 root root July May 11 2017 / sbin/clock-> hwclock
two。 Synchronize system time to hardware clock
Check the system time, which is on November 2, 2018.
[root@xuegod65 ~] # date
Friday 02 November 2018 22:30:08 CST
View hardware time May 22, 2018
[root@xuegod65 ~] # hwclock
Tuesday, May 22, 2018, 10:56:35-0.921030 seconds
Update the system time to the hardware clock
[root@xuegod65] # hwclock-w
Verify that the hardware clock has been updated successfully
[root@xuegod65 ~] # hwclock
Friday, 02 November 2018 22:36:21-0.458489 seconds
3.3.2 modify system time
Command: date
Parameter: date-help
Modify system time
-s,-- set=STRING sets the time to the time described by the string
[root@xuegod63] # date-s "2018-11-2 22:30"
Friday 02 November 2018 22:30:00 CST
% F full date format, equivalent to% Y-%m-%d
[root@xuegod63 ~] # date "+% F"
2018-11-02
% y year last two digits (00-99)
% Y year
% m month (01.. 12)
% d monthly date (for example: 01)
% M minute (00.59)
% H hours (00-23)
% s seconds (00-60)
[root@xuegod63 ~] # date "+% Y%m%d"
20181102
# you can add the symbols you want before the day of the year
[root@xuegod63 ~] # date "+% Y-%m-%d% H:%M:%S"
2018-11-02 22:34:27
-d,-- date=STRING # displays the time described by a string instead of "current time"
[root@xuegod63 ~] # date-d "+ 1 months" +% F
2018-12-02
Synchronize network time to system time
[root@localhost ~] # ntpdate 210.72.145.44
27 Mar 11:11:24 ntpdate [4766]: adjust time server 210.72.145.44 offset 0.011401 sec
210.72.145.44 (IP domain name of the official time synchronization server of Xi'an time Service Center in China)
After synchronizing the network time to the system time, you can synchronize the system time to the hardware time with hwclock-w.
Modify time zone
It is possible that some systems still fail after restarting after performing the above two steps, so time zone modification is needed.
[root@localhost ~] # tzselect # follow the prompts to select the time zone
[root@localhost ~] # ln-sf / usr/share/zoneinfo/Asia/Shanghai / etc/localtime
Modify system time profile
[root@localhost ~] # / etc/sysconfig/clock
# Open the clock file and change the relevant content to the following
UTC=true
ARC=false
ZONE= "Asia/Shanghai"
Restart the system
[root@localhost ~] # reboot
The above content is how to analyze the time management of Linux system. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.