Ntp-based multi-server time synchronization script and ntp 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/bashtime = 5ip () {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 sttelse # echo "not null" stp upd sttfi} ntp () {while truedosleep $ timefor I in 'IP' do ssh $ I ntpdate 192.168.48.117 if [[00 = 'date | awk-F ": "'{print $2}''] then not sleep 240 break fidonedone} ntp &
What else do you think about!