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
Automatic tuning of Linux system time and time zone for Internet time synchronization