#!/bin/bash now_date=`date +%Y%m%d%H:%m:%s` cd /home/oracle/go_program now_date=`date +%Y%m%d%H:%m:%s` cd /home/oracle/go_program ip_list=(192.168.1.22 192.168.1.113 192.168.1.130 192.168.1.131 192.168.1.8 192.168.1.92 192.168.1.63 192.168.1.99 192.168.1.90) for ipaddr in "${ip_list[@]}" do while (true) do output=`./wrong_sql_send ${ipaddr}` echo ${now_date}'|'$output>>/tmp/${ipaddr}.log tail -1 /tmp/${ipaddr}.log|grep timeout send_flag=$? ##发送不成功,再次发送 if [ $send_flag -eq 0 ];then output=`./wrong_sql_send ${ipaddr}` echo ${now_date}'|'$output>>/tmp/${ipaddr}.log fi tail -1 /tmp/${ipaddr}.log|grep timeout send_flag=$? echo $send_flag if [ $send_flag -eq 1 ];then break fi done done
双重循环例子
猜你喜欢
转载自www.cnblogs.com/hxlasky/p/11347197.html
今日推荐
周排行