NTP-based multi-server time synchronization script

Source: Internet
Author: User
Tags server installation and configuration

NTP-based multi-server time synchronization script

The server updates the time every hour. The synchronization server of the server synchronizes the time every five seconds. The synchronization server does not interact with the Internet, and the synchronization time is performed by the server. Therefore, ensure that the time of each synchronization server is consistent.

# Vi ud_ntp.sh

#! /Bin/bash
Time = 5
Ip (){
Echo "192.168.48.114"
Echo "192.168.28.233"
}
Stp (){
/Etc/init. d/ntpd stop
}
Upd (){
Ntpdate us.pool.ntp.org
}
Stt (){
/Etc/init. d/ntpd start
}

Num = 'ps-ef | grep ntpd. pid | grep-v grep'
Not (){
If [! -N "$ num"]; then
# Echo "is null"
Upd
Stt
Else
# Echo "not null"
Stp
Upd
Stt
Fi
}

Ntp (){
While true
Do
Sleep $ time
For I in 'IP'
Do
Ssh $ I ntpdate 192.168.48.117
If [[00 = 'date | awk-F ":" '{print $2} '']
Then
Not
Sleep 240
Break
Fi
Done
Done
}
Ntp &

What else do you think about!

CentOS NTP server installation and configuration

NTP servers in Linux

NTP client configurations for multiple operating systems

Build an enterprise-level NTP Time Server

Set up an ntp time synchronization server in Linux

Enable NTP time server in CentOS 6.3

This article permanently updates the link address:

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.