嵌入式linux双机热备份倒换处理代码

源代码在线查看: ping.sh

软件大小: 61 K
上传用户: QQ
关键词: linux 嵌入式 双机热 代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				#!/bin/sh								PING=/bin/ping				SH=/bin/sh				RM=/bin/rm				NOIP=1				if [ -f ./ping.ok ]; then					$RM ./ping.ok				fi				for i in `cat ./ping.conf`				do					if [ "$i" != "" ]; then						NOIP=0						$SH -c "$PING -c1 $i 2>/dev/null 1>/dev/null && echo ok > ./ping.ok" &					fi				done				if [ "$NOIP" == "1" ]; then					exit 0				fi				COMPT=20				while [ $COMPT -ne 0 ]; do					if [ -f ./ping.ok ]; then 						RES=`cat ./ping.ok`					fi					if [ "$RES" == "ok" ]; then						$RM ./ping.ok						exit 0;					fi					COMPT=$[$COMPT-1]					sleep 1				done				echo "ping.sh => Alert ! NO responses !" >> /var/log/ha-log				exit 1;							

相关资源