Linux host time synchronization Summary (ntpdate)

Source: Internet
Author: User

Linux host time synchronization Summary (ntpdate)

Time Synchronization is required when the production server is deployed,In particular, the Database Host must synchronize time,Prevent low-level errors!

Summarize my deployment experience:

1. Create a timing synchronization policy in crontab;

05 06, 12, 18, 23 ***/usr/sbin/ntpdate-us ntp.nasa.gov ntp.sjtu.edu.cn; hwclock-w;

2. Add a time synchronization policy to the startup Item.

/Usr/sbin/ntpdate-us ntp.nasa.gov ntp.sjtu.edu.cn; hwclock-w;

Note:-us parameter:-u is synchronized through the firewall of ntpserver, and s is used to write synchronization logs to system logs;

One-click deployment script writing:

# Cat synctime. sh

 

<Span style = "font-size: 14px;"> #! /Bin/shrpm-Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpmyum-y install ntpdatecat <EOF>/var/spool/cron/root # Time Synchronization 05, ***/usr/sbin/ntpdate-us ntp.nasa.gov ntp.sjtu.edu.cn; hwclock-w; EOFecho "/usr/sbin/ntpdate-us ntp.nasa.w.w.hwclock-w; ">/etc/rc. local/bin/sh/usr/sbin/ntpdate-us ntp.nasa.gov ntp.sjtu.edu.cn; hwclock-w; echo "Time Synchronization deployment OK" </span>
<span style="font-size:14px;"></span>


 

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.