Linux_ automatic tuning of Linux system time and time zone with Internet time synchronization

Source: Internet
Author: User

Adjust Linux system time and time zone with Internet time synchronize one, modify time zone:
# Cp/usr/share/zoneinfo/asia/shanghai/etc/localtime
Modified to China's East eight district
# Vi/etc/sysconfig/clock
Zone= "Asia/shanghai"
Utc=false
Arc=false Second, configure the new time
Date setting:
# Date-s 2008/05/06 Time setting:
# date-s 18:40:00 View hardware time (BIOS):
Hwclock [-RW]
-R: View the existing BIOS time, default to-R parameter
-W: Writes the current Linux system time to the BIOS when we finish the Linux time, we also need to update the BIOS time with HWCLOCK-W, because the system will re-read the time from the BIOS each time it is powered on, so the BIOS is the most important time According to
# Hwclock
Tue 03:49:37 PM CST-0.039646 seconds synchronous BIOS clock, forcing system time to be written to CMOS:
# Clock-w Three, to achieve Internet time synchronization (here can ignore the above two steps)
Method 1. When you start the computer automatically when the network:
Vi/etc/rc.d/rc.local
/usr/sbin/ntpdate-u 192.168.0.2 192.168.0.3 192.168.0.4; /sbin/hwclock-w Method 2. Set up Scheduled Tasks
The crontab format is as follows:
# for details see Mans 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 are also available in two ways: 1, written in/etc/crontab
Code:
XX * * * Root ntpdate 210.72.145.44
Sync time with China National Timing Center at 11 o ' Day
Sync time with China National Timing Center at 11 o ' Day
Of course the premise is
Apt-get Install Ntpdate code is also
XX * * * Root ntpdate us.pool.ntp.org
2. Using Command crontab-e
Crontab-e
5 * * * Root ntpdate us.pool.ntp.org;hwclock-w
This is done automatically at 5:10 every day, and when the BIOS is updated at the same time

Linux_ automatic tuning of Linux system time and time zone with Internet time synchronization

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.