diff --git a/client/conf-client/Card_10.10.10.3-1666.cfg b/client/conf-client/Card_10.10.10.3-1666.cfg new file mode 100644 index 0000000..352b702 --- /dev/null +++ b/client/conf-client/Card_10.10.10.3-1666.cfg @@ -0,0 +1,4 @@ +10.10.10.3:1666#file#/tmp/coucou +10.10.10.3:1666#file#/tmp/nop +10.10.10.3:1666#file# +10.10.10.3:1666#NotRealSondeName#reboot diff --git a/client/conf-client/Card_10.10.10.4-1666.cfg b/client/conf-client/Card_10.10.10.4-1666.cfg new file mode 100644 index 0000000..8b0ba03 --- /dev/null +++ b/client/conf-client/Card_10.10.10.4-1666.cfg @@ -0,0 +1,4 @@ +10.10.10.4:1666#file#/tmp/coucou +10.10.10.4:1666#file#/tmp/nop +10.10.10.4:1666#file# +10.10.10.4:1666#NotRealSondeName#reboot diff --git a/client/conf-client/exec.sh b/client/conf-client/exec.sh index a324d69..2307940 100755 --- a/client/conf-client/exec.sh +++ b/client/conf-client/exec.sh @@ -6,22 +6,29 @@ cd $(dirname $0) SondeFile=$(pwd)/sonde.cfg source service.cfg source functions +ConfFile=$1 -#[[ "${Crypted}" == "yes" ]] && NcCmd="timeout ${TimeOut} cryptcat -k ${LocalPassword} ${RemoteIp} ${RemotePort} " || NcCmd="timeout ${TimeOut} nc ${RemoteIp} ${RemotePort}" [[ "${Crypted}" == "yes" ]] && NcCmd="timeout ${TimeOut} cryptcat -k ${LocalPassword} " || NcCmd="timeout ${TimeOut} nc " +while [[ ! -f /tmp/endmonitor ]] + do + if [[ -f /tmp/Monithor_${ConfFile}-tmp ]] + then -PrintWeb START_TRATS - while read DATA - do - Remote=$(echo $DATA| cut -d"#" -f1| cut -d":" -f1) - Port=$(echo $DATA| cut -d"#" -f1| cut -d":" -f2) - Cmd=$(echo $DATA| cut -d"#" -f2) - Arg=$(echo $DATA| cut -d"#" -f3) - Res=$( echo -e "${Cmd}#${Arg}" | eval ${NcCmd} ${Remote} ${Port} 2> /dev/null) - Ret=$? - PrintRes "${Res:-5|No sonde $Cmd on serveur $Remote}" - PrintWeb "${Res:-5|No sonde $Cmd on serveur $Remote}" ${Cmd:-Nodata} ${Arg:-Noadata} ${Remote:-Nodata} - done < ${SondeFile} -PrintWeb END_DNE + sleep ${Rotation} + GenerateWebEnd /tmp/Monithor_${ConfFile}-tmp + CheckAllEnd ${TotalConfig} + else + while read DATA + do + Remote=$(echo $DATA| cut -d"#" -f1| cut -d":" -f1) + Port=$(echo $DATA| cut -d"#" -f1| cut -d":" -f2) + Cmd=$(echo $DATA| cut -d"#" -f2) + Arg=$(echo $DATA| cut -d"#" -f3) + Res=$( echo -e "${Cmd}#${Arg}" | eval ${NcCmd} ${Remote} ${Port} 2> /dev/null) + Ret=$? + GenerateWeb "${Res:-5|No sonde $Cmd on serveur $Remote}" ${Cmd:-Nodata} ${Arg:-Noadata} ${Remote:-Nodata} /tmp/Monithor_${ConfFile}-tmp + done < ${ConfFile} + fi + done diff --git a/client/conf-client/functions b/client/conf-client/functions index 7944d32..7354bc7 100644 --- a/client/conf-client/functions +++ b/client/conf-client/functions @@ -5,16 +5,25 @@ PrintRes() { } -PrintWeb() { +CheckAllEnd() { - if [[ ! -f /tmp/webmonithor ]] || [[ "$1" == "START_TRATS" ]] + Total=$1 + Actual=0 + for AcutalFile in $(find /tmp/ -name Monithor_\*-tmp) + do + [[ ! -z $(tail -n 1 $ActualFile | grep 'End of') ]] && Acutal=$((Actual + 1)) + done + + if [[ ${Total} -eq ${Actual} ]] then - echo ' + + echo '