Linux Time Synchronization Script

Source: Internet
Author: User

Resources:
Http://www.cnblogs.com/liushui-sky/p/9203657.html (Perfer should be prefer in the blog)

https://www.jianshu.com/p/80ab71d50872

Https://www.cnblogs.com/quchunhui/p/7658853.html

Https://www.cnblogs.com/kerrycode/archive/2015/08/20/4744804.html

Man-k NTP
Mans Ntp.config

NTP server address:
http://www.ntp.org.cn

Precautions:
1, firewall release 123 port
2, if the master-slave service time more than 1000 seconds is no longer synchronized, this time to manually synchronize,

CENTOS6 script (using ntp/ntpdate): 1, server-side configuration
#!/bin/bash#1、不用判断,直接安装,有的话就不会安装,没的话也就安装上了。yum -q -y ntp ntpdate &>/dev/null#2、配置ntp服务sed -i ‘s/^server/#server/g‘  /etc/ntp.confsed -i ‘s/^restrict -6/#restrict -6/g‘  /etc/ntp.confcat >> /etc/ntp.conf <<eof#start custom config#添加同步的服务器地址server cn.ntp.org.cn prefer#权限控制restrict  

Above, after 5 minutes Ntpstat check whether the synchronization, such as

2. Client Configuration
和服务器一样,只不过server地址改成ntp服务器地址即可。

Centos7 script (using Chrony):

Ntp.conf
1. Configure the synchronization source
2. Configure permissions
3, configure the operating mode and encryption mode.

Linux Time Synchronization Script

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.