Auto adjust time and time zone and Internet time synchronization under Linux __linux

Source: Internet
Author: User

First, the installation of NTP II, synchronization time three, the system time to write to the system hardware, to avoid restarting the server time coverage of four, set Schedule task synchronization network time issues Appendix I, Installation NTP

[Root@server-2 ~]# Yum install-y ntpdate
second, synchronization time
Way one, use domain name connection, want to go through DNS resolution, slow speed.
[root@server-2 ~]# ntpdate pool.ntp.org
/Mode Two, use IP connection, super fast.
[root@server-2 ~]# ntpdate 120.24.81.91


http://www.pool.ntp.org is the official website of NTP, where we can find the NTP server from our country. Cn.pool.ntp.org. It has 3 server addresses:
server one:        1.cn.pool.ntp.org
Server two:        2.asia.pool.ntp.org
Server three:        3.asia.pool.ntp.org
(There are sometimes problems with the domain name, you can ping their IP first, and then sync with the IP address)


//The following information shows the success of the
5 Feb 21:23:06 ntpdate[62910 ]: Step Time Server 182.92.12.11 offset-40.589470 sec
third, the system time to write to the system hardware, to avoid restarting the server time coverage
Display Hardwareclock System hardware time
[root@server-2 ~]# hwclock
//write system time to system hardware
[root@server-2 ~]# hwclock-w
Set Schedule Task synchronization network time
The crontab format is as follows: # For details look man
4 crontabs
# Example of job definition:
#.----------------Minute (0-59)
# |  . -------------Hour (0-23)
# |  |  ----------Day of Month (1-31)
# | | |  . -------Month (1-12) OR jan,feb,mar,apr ...
# |  |  |  |  . ----Day of Week (0-6) (sunday=0 or 7) or Sun,mon,tue,wed,thu,fri,sat
#
| | | * * * * * *  command to  be executed
set crontab scheduled tasks in two ways:
1, written in the/etc/crontab
Code: * * * * * *
root ntpdate 210.72.145.44
11 daily sync time with China National Service Center at
11 times a
day sync time with China National Timing center of course, if Apt-get Install ntpdate Code * * *
root ntpdate us.pool.ntp.org
2, use command crontab-e
crontab-e
  10 5 * * * * * * Root ntpdate us.pool.ntp.org;hwclock-w The
time when the network is automatically 5:10 every day, and the BIOS is updated simultaneously
######################## ########
problem Appendix
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.