#script sends advices to BANK # main fuction same for SMS and BASE II function ssendfunc { LIST=`cat temporary.tst` for I in $LIST # processing every BIN do date echo processing $I COUNT=0 if [[ `istadvicecmd list | grep -c $I` != 0 ]]; # checking current BIN presence in queue then Z=`istadvicecmd list | awk -v PAT="$I" 'index($0, PAT) { getline; getline; print $2; }'` # checking if [[ $Z -eq 0 ]]; # pending value for current BIN then echo sendnig advices istadvicecmd set $I 0 $SENDTYPE # sending... at all sleep 3 Z=`istadvicecmd list | awk -v PAT="$I" 'index($0, PAT) { getline; getline; print $2; }'` while [[ $Z != 0 ]]; # wait for advices to deliver do if [[ `istadvicecmd list | grep -c $I` = 0 ]]; # checking if BIN still in queue then echo no more $I BIN in queue break fi # show current delivering status Z=`istadvicecmd list | awk -v PAT="$I" 'index($0, PAT) { getline; getline; print $2; }'` X=`istadvicecmd list | awk -v PAT="$I" 'index($0, PAT) { getline; getline; print $1; }'` Y=`istadvicecmd list | awk -v PAT="$I" 'index($0, PAT) { getline; getline; print $3; }'` A=`istadvicecmd list | awk -v PAT="$I" 'index($0, PAT) { getline; getline; print $4; }'` date echo Sending $I; echo Messages: $X echo Pending: $Z echo Done: $Y echo Skiped: $A K=0 if [[ $Z -eq $K ]]; then let COUNT=COUNT+1 echo count -- $COUNT fi K=$Z if [[ $COUNT -gt 100 ]]; then echo The limit has been exhausted Restarting advice services mbcmd kill istadvice mbcmd kill istreplay sleep 3 mbcmd run istadvice mbcmd run istreplay fi sleep 3 # end of status monitor done echo waiting 60 seconds before process next BIN sleep 60 else echo $I still pending fi else echo there is no $I BIN in queue fi done } if [[ `/path/path1/script | awk '{print $1}'` != "Caution!!" ]] ; # is there running Topaz at node then cd /home/user1 # becoming real . .profile # user1 user echo Sending BASE II advices sqlplus login/password @'/path/chkb.sql' exit | grep 0000 > temporary.tst # loading current BANK BASE II BINs SENDTYPE=send ssendfunc echo Sending SMS advices sqlplus login/password @'/path/chk.sql' exit | grep 0000 > temporary.tst # loading current BANK SMS BINs SENDTYPE=sendsms ssendfunc more /path/sendadvice.debug | mail admins@server1 > /path/sendadvice.debug rm temporary.tst fi