logo资料库

linux下ntp协议的官方文档.pdf

第1页 / 共16页
第2页 / 共16页
第3页 / 共16页
第4页 / 共16页
第5页 / 共16页
第6页 / 共16页
第7页 / 共16页
第8页 / 共16页
资料共16页,剩余部分请下载后查看
Keeping the system time on your Linux box correct. Edward Corrado Presented at the monthly meeting of the Cherry Hill Linux Users Group on April 1, 2005
Objective Candidate should be able to properly maintain the system time and synchronize the clock over NTP. Tasks include setting the system date and time, setting the BIOS clock to the correct time in UTC, configuring the correct timezone for the system and configuring the system to correct clock drift to match NTP clock.
Key Files, Terms, Utilities ● /etc/timezone ● /usr/share/zoneinfo ● /etc/localtime ● /etc/ntp.conf ● /etc/ntp.drift ● date ● hwclock ● ntpd ● ntpdate
Options to date [ecorrado@ecorrado ~]$ date --help Usage: date [OPTION]... [+FORMAT] or: date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] Display the current time in the given FORMAT, or set the system date. -d, --date=STRING display time described by STRING, not `now' -f, --file=DATEFILE like --date once for each line of DATEFILE -ITIMESPEC, --iso-8601[=TIMESPEC] output date/time in ISO 8601 format. TIMESPEC=`date' for date only, `hours', `minutes', or `seconds' for date and time to the indicated precision. --iso-8601 without TIMESPEC defaults to `date'. -r, --reference=FILE display the last modification time of FILE -R, --rfc-2822 output RFC-2822 compliant date string -s, --set=STRING set time described by STRING -u, --utc, --universal print or set Coordinated Universal Time --help display this help and exit --version output version information and exit
/etc/timezone This is a text file that lists the time zone for the machine. An example would be: Pacific/Aukland or US/Eastern
/usr/share/zoneinfo/* /etc/localtime /usr/share/zoneinfo/ is a directory that has all of the time zones in it. To setup your timezone, you want to link /etc/localtime to it. For example. livecd / # ls /usr/share/zoneinfo/US Alaska Arizona East-Indiana Hawaii Michigan Pacific Aleutian Central Eastern Indiana-Starke Mountain Samoa livecd / # ln -sf /usr/share/zoneinfo/US/Pacific /etc/localtime
date ● The date command without any options will print the current date and time. ● The date will be relative to any timezone set for the machine. ● ● [lug@ip]$ date ● Fri Mar 4 19:57:51 EST 2004
hwclock ● Hwclock queries and sets the hardware clock ● The Real Time Clock (RTC) is the hardware clock and is located on the motherboard. This is what keeps track of the time when the system is not powered up. The system clock is maintained in the Linux kernel and is used while the system is running.
分享到:
收藏