server服務器每1個小時更新一次時間,server服務器旗下同步服務器每5秒鐘同步一次時間,同步服務器與外網不做交互,由server服務器進行同步時間。所以保證每一臺同步服務器時間一致。
#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&
還有什么考慮不周全的地方,大家指正!
新聞熱點
疑難解答