[1849] | 1 | #!/bin/bash |
---|
| 2 | |
---|
[1853] | 3 | function update_tasks_list |
---|
| 4 | { |
---|
| 5 | local tasksListFile=$1 # fichier contenant la nouvelle liste de cmds |
---|
| 6 | touch $tasksListFile |
---|
| 7 | local logFileOfPrevPack=$2 # fichier log de relatif a l'execution de la derniere liste de cmds |
---|
| 8 | local tasksListFileOfPrevPack=$3 # fichier contenant la derniere liste de cmds |
---|
| 9 | |
---|
| 10 | > $tasksListFile |
---|
| 11 | |
---|
| 12 | old_IFS=$IFS # sauvegarde du séparateur de champ |
---|
| 13 | IFS=$'\n' # nouveau séparateur de champ, le caractère fin de ligne |
---|
| 14 | for cmdReport in $( cat $logFileOfPrevPack ) |
---|
| 15 | do |
---|
| 16 | hasCmdGoodFormat=`echo $cmdReport | grep -e '^#executed by process' | wc -l ` |
---|
| 17 | if [ "x${hasCmdGoodFormat}" == "x0" ] |
---|
| 18 | then |
---|
| 19 | continue |
---|
| 20 | fi |
---|
| 21 | |
---|
| 22 | local resCmd=`echo $cmdReport | awk '{print $9}' ` |
---|
| 23 | |
---|
| 24 | if [ "x$resCmd" != "x0" ] |
---|
| 25 | then |
---|
| 26 | local cmdToPrint=`echo $cmdReport | awk '{print $NF}' ` |
---|
[1863] | 27 | case "x$resCmd" in |
---|
| 28 | x5) |
---|
| 29 | newCmdToPrint=`echo $cmdToPrint | sed 's;output_ncrcat;output_tar;' ` |
---|
| 30 | echo "./process_list.sh $newCmdToPrint" >> ${tasksListFile} |
---|
| 31 | ;; |
---|
| 32 | x10) |
---|
| 33 | echo "./process_list.sh $cmdToPrint" >> ${tasksListFile} |
---|
| 34 | newCmdToPrint=`echo $cmdToPrint | sed 's;output_ncrcat;output_tar;' ` |
---|
| 35 | echo "./process_list.sh $newCmdToPrint" >> ${tasksListFile} |
---|
| 36 | ;; |
---|
[1864] | 37 | x50) |
---|
| 38 | # ne fait rien, la liste, au depart a concatener, a ete taree |
---|
| 39 | # car echec de la concatenation |
---|
| 40 | ;; |
---|
[1863] | 41 | *) |
---|
| 42 | echo "./process_list.sh $cmdToPrint" >> ${tasksListFile} |
---|
| 43 | ;; |
---|
| 44 | esac |
---|
[1853] | 45 | fi |
---|
| 46 | done |
---|
| 47 | IFS=$old_IFS # rétablissement du séparateur de champ par défaut |
---|
| 48 | |
---|
| 49 | # Il faut aussi rajouter les cmds qui n'ont pas ete traitees du tout, |
---|
| 50 | # par exemple en cas d'interruption du calculateur |
---|
| 51 | # Pour cela, on boucle sur la derniere liste de cmds et on cherche dans le |
---|
| 52 | # fichier log associe si certaines sont absentes. On remet ces commandes (absentes) |
---|
| 53 | # dans la nouvelle liste |
---|
| 54 | old_IFS=$IFS # sauvegarde du séparateur de champ |
---|
| 55 | IFS=$'\n' # nouveau séparateur de champ, le caractère fin de ligne |
---|
| 56 | for cmd in $( cat $tasksListFileOfPrevPack ) |
---|
| 57 | do |
---|
| 58 | local list=`echo $cmd | awk '{print $NF}' ` |
---|
| 59 | hasListBeenTreated=`grep $list $logFileOfPrevPack | wc -l ` |
---|
| 60 | if [ "x${hasListBeenTreated}" == "x0" ] |
---|
| 61 | then |
---|
| 62 | echo $cmd >> ${tasksListFile} |
---|
| 63 | fi |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | done |
---|
[1864] | 67 | IFS=$old_IFS # rétablissement du séparateur de champ par défaut |
---|
| 68 | |
---|
| 69 | # Il peut arriver que 2 listes soient identiques, on empeche ce cas |
---|
| 70 | cat ${tasksListFile} | sort | uniq > taskFile.txt |
---|
| 71 | cat taskFile.txt > ${tasksListFile} |
---|
[1853] | 72 | |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | function getNumeroOfCurrentTry |
---|
| 76 | { |
---|
| 77 | local num_try="1" |
---|
| 78 | tryNumFile=${USER_OUTPUT_PROGRESS}/numero_current_try.txt |
---|
| 79 | if [ ! -e $tryNumFile ] |
---|
| 80 | then |
---|
| 81 | echo "Le fichier :" >> $badFailureFile |
---|
| 82 | echo "$tryNumFile" >> $badFailureFile |
---|
| 83 | echo "doit etre present dans le repertoire :" >> $badFailureFile |
---|
| 84 | echo "${USER_OUTPUT_PROGRESS}" >> $badFailureFile |
---|
| 85 | echo "et il doit contenir un numero d'essai" >> $badFailureFile |
---|
| 86 | exit 1 |
---|
| 87 | fi |
---|
| 88 | num_try=`head -n 1 $tryNumFile ` |
---|
| 89 | echo $num_try |
---|
| 90 | |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | function getNumeroOfLastInstance |
---|
| 94 | { |
---|
| 95 | local num_instance="0" |
---|
| 96 | local numTry=$1 |
---|
| 97 | ici=$PWD |
---|
| 98 | local progressDirectory="${USER_OUTPUT_PROGRESS}/TRY__${numTry}" |
---|
| 99 | if [ ! -e $progressDirectory ] |
---|
| 100 | then |
---|
| 101 | echo "fonction getNumeroOfLastInstance :" >> $badFailureFile |
---|
| 102 | echo "Le repertoire :" >> $badFailureFile |
---|
| 103 | echo "$progressDirectory" >> $badFailureFile |
---|
| 104 | echo "devrait exister. Il n'existe pas." >> $badFailureFile |
---|
| 105 | exit 1 |
---|
| 106 | fi |
---|
| 107 | cd $progressDirectory |
---|
| 108 | |
---|
| 109 | listFiles=`ls | grep -e "inputCmd__try__${numTry}__instance__[[:digit:]]\{1,2\}.list" ` |
---|
| 110 | for listFile in $listFiles |
---|
| 111 | do |
---|
| 112 | num=`echo $listFile | awk -F"__" '{print $NF}' | awk -F"." '{print $1}' ` |
---|
| 113 | if [ $num -gt $num_instance ] |
---|
| 114 | then |
---|
| 115 | num_instance=$num |
---|
| 116 | fi |
---|
| 117 | done |
---|
| 118 | cd $ici |
---|
| 119 | echo $num_instance |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | |
---|
| 125 | function check_progress |
---|
| 126 | { |
---|
| 127 | local file1=$1 |
---|
| 128 | local file2=$2 |
---|
| 129 | if [ "x${file1}" == "x" ] || [ "x${file2}" == "x" ] |
---|
| 130 | then |
---|
| 131 | echo "check_progress : Le nom d'au moins 1 des 2 fichiers d'entree est vide" >> $badFailureFile |
---|
| 132 | exit 1 |
---|
| 133 | fi |
---|
| 134 | |
---|
| 135 | if [ ! -e $file1 ] || [ ! -e $file2 ] |
---|
| 136 | then |
---|
| 137 | echo "check_progress : au moins un des 2 fichiers suivants n'existe pas :" >> $badFailureFile |
---|
| 138 | echo "$file1" |
---|
| 139 | echo "$file2" |
---|
| 140 | exit 1 |
---|
| 141 | fi |
---|
| 142 | local nbLineFile1=`cat $file1 | wc -l ` |
---|
| 143 | local nbLineFile1=`cat $file2 | wc -l ` |
---|
| 144 | if [ $nbLineFile1 -ne $nbLineFile1 ] |
---|
| 145 | then |
---|
| 146 | echo 1 |
---|
| 147 | return |
---|
| 148 | fi |
---|
| 149 | |
---|
| 150 | old_IFS=$IFS # sauvegarde du séparateur de champ |
---|
| 151 | IFS=$'\n' # nouveau séparateur de champ, le caractère fin de ligne |
---|
| 152 | for line in $( cat $file1 ) |
---|
| 153 | do |
---|
| 154 | # echo $line |
---|
| 155 | local isLineInFile2=`grep $line $file2 | wc -l ` |
---|
| 156 | if [ $isLineInFile2 -eq 0 ] |
---|
| 157 | then |
---|
| 158 | echo 1 |
---|
| 159 | return |
---|
| 160 | fi |
---|
| 161 | done |
---|
| 162 | IFS=$old_IFS # rétablissement du séparateur de champ par défaut |
---|
| 163 | echo 0 |
---|
| 164 | } |
---|
| 165 | |
---|
| 166 | |
---|
| 167 | function update_report |
---|
| 168 | { |
---|
| 169 | > $reportFile # on vide le fichier rapport |
---|
| 170 | echo "Execution of tasks :" >> $reportFile |
---|
| 171 | echo "------------------" >> $reportFile |
---|
| 172 | cat $inputCmd >> $reportFile |
---|
| 173 | echo >> $reportFile |
---|
| 174 | echo "Results of tasks :" >> $reportFile |
---|
| 175 | echo "----------------" >> $reportFile |
---|
| 176 | cat $output >> $reportFile |
---|
| 177 | echo >> $reportFile |
---|
| 178 | echo >> $reportFile |
---|
| 179 | |
---|
| 180 | } |
---|
| 181 | |
---|
[1864] | 182 | export RANDOM=$$ # random seed |
---|
| 183 | function gives_random_number |
---|
| 184 | { |
---|
| 185 | lim=$1 |
---|
| 186 | bit=-1 |
---|
| 187 | let "bit = RANDOM % $lim" |
---|
| 188 | bit=$(( $bit + 1 )) # nb entre 1 et $limit |
---|
| 189 | echo $bit |
---|
| 190 | } |
---|
| 191 | |
---|
[1853] | 192 | ########## batch directives : begin ########## |
---|
[1849] | 193 | #MSUB -r pack_ipsl # Nom du job |
---|
[1853] | 194 | ### mutable directives ### |
---|
[1863] | 195 | #MSUB -o /ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_PROGRESS/zIGCM_OUT/detailed_pack_output/pack_ipsl_%I.o |
---|
| 196 | #MSUB -e /ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable/GUILLAUME/PSEUDO_DMNFS_PROGRESS/zIGCM_OUT/detailed_pack_output/pack_ipsl_%I.e |
---|
| 197 | #MSUB -n 7 |
---|
[1853] | 198 | #MSUB -T 900 |
---|
[1849] | 199 | #MSUB -A tgcc0013 |
---|
| 200 | #MSUB -q standard |
---|
| 201 | #MSUB -Qos test |
---|
[1853] | 202 | ########## batch directives : end ########## |
---|
[1849] | 203 | |
---|
| 204 | export JOB_DIR=${LS_SUBCWD:-${PWD}} |
---|
| 205 | export EXE_DIR=${JOB_DIR} |
---|
| 206 | source ${EXE_DIR}/DEM_utilities.sh |
---|
| 207 | |
---|
[1853] | 208 | export badFailureFile=${USER_OUTPUT_PROGRESS}/badFailure.txt |
---|
[1849] | 209 | |
---|
[1853] | 210 | export numCurrentTry=$( getNumeroOfCurrentTry ) |
---|
| 211 | export progressDir="${USER_OUTPUT_PROGRESS}/TRY__${numCurrentTry}" |
---|
| 212 | if [ ! -e $progressDir ] |
---|
| 213 | then |
---|
| 214 | echo "Le repertoire de suivi :" >> $badFailureFile |
---|
| 215 | echo "$progressDir" >> $badFailureFile |
---|
| 216 | echo "n'existe pas. STOP." >> $badFailureFile |
---|
| 217 | exit 1 |
---|
| 218 | fi |
---|
| 219 | export numPrevInstance=$( getNumeroOfLastInstance $numCurrentTry ) |
---|
| 220 | export numNewInstance=$(( $numPrevInstance + 1 )) |
---|
[1849] | 221 | |
---|
[1853] | 222 | export inputCmd="${progressDir}/inputCmd__try__${numCurrentTry}__instance__${numNewInstance}.list" |
---|
| 223 | export nextInputCmd="${progressDir}/nextInputCmd__try__${numCurrentTry}__instance__${numNewInstance}.list" |
---|
| 224 | export output="${progressDir}/packOutput__try__${numCurrentTry}__instance__${numNewInstance}.log" |
---|
| 225 | export reportFile="${progressDir}/report__try__${numCurrentTry}__instance__${numNewInstance}.log" |
---|
[1864] | 226 | export checkFile="${progressDir}/check__try__${numCurrentTry}__instance__${numNewInstance}.log" |
---|
| 227 | export checkFileTmp="checkTmp__try__${numCurrentTry}__instance__${numNewInstance}.txt" |
---|
[1849] | 228 | |
---|
[1853] | 229 | export noInterruptFile="${progressDir}/noInterrupt__try__${numCurrentTry}__instance__${numNewInstance}.txt" |
---|
[1849] | 230 | |
---|
| 231 | |
---|
[1853] | 232 | # a virer |
---|
| 233 | #echo "inputCmd=$inputCmd" >> $badFailureFile |
---|
| 234 | #echo "nextInputCmd=$nextInputCmd" >> $badFailureFile |
---|
| 235 | #echo "output=$nextInputCmd" >> $badFailureFile |
---|
| 236 | #echo "reportFile=$nextInputCmd" >> $badFailureFile |
---|
| 237 | #echo "noInterruptFile=$noInterruptFile" >> $badFailureFile |
---|
[1849] | 238 | |
---|
[1853] | 239 | # exit 0 # a virer |
---|
| 240 | |
---|
| 241 | # a virer |
---|
| 242 | #if [ ${numNewInstance} -ge 4 ] |
---|
| 243 | #then |
---|
| 244 | # echo "inputCmd=$inputCmd" >> $badFailureFile |
---|
| 245 | # echo "nextInputCmd=$nextInputCmd" >> $badFailureFile |
---|
| 246 | # echo "output=$nextInputCmd" >> $badFailureFile |
---|
| 247 | # echo "reportFile=$nextInputCmd" >> $badFailureFile |
---|
| 248 | # echo "noInterruptFile=$noInterruptFile" >> $badFailureFile |
---|
| 249 | # echo >> $badFailureFile |
---|
| 250 | #fi |
---|
| 251 | |
---|
| 252 | if [ ${numCurrentTry} -le 1 ] && [ ${numNewInstance} -le 1 ] |
---|
| 253 | then |
---|
| 254 | # C'est le tout premier essai |
---|
| 255 | # on construit la liste des taches a effectuer en inventoriant les fichiers *.liste |
---|
| 256 | # dans les rep contenus dans le fichier "config_card.liste" |
---|
| 257 | > ${inputCmd} |
---|
| 258 | for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do |
---|
| 259 | |
---|
| 260 | PATH_SIMU=$( dirname $CONFIG ) |
---|
| 261 | # echo "PATH_SIMU=$PATH_SIMU" |
---|
| 262 | |
---|
| 263 | setOfListFiles=`find $PATH_SIMU -type f -name "*.list" ` |
---|
| 264 | for file in $setOfListFiles |
---|
[1849] | 265 | do |
---|
[1853] | 266 | echo "./process_list.sh $file" >> ${inputCmd} |
---|
[1863] | 267 | done |
---|
[1853] | 268 | done |
---|
[1863] | 269 | |
---|
[1853] | 270 | else |
---|
| 271 | # if try > 1 && inst == 1 ==> construction liste cmd avec fichiers try - 1, derniere instance |
---|
| 272 | # dans ce dernier cas, gerer une eventuelle interruption au try - 1 |
---|
| 273 | # if try > 1 && inst > 1 ==> construction liste cmd avec fichiers try, instance precedente |
---|
| 274 | if [ ${numNewInstance} -ge 2 ] |
---|
| 275 | then |
---|
| 276 | nextInputCmd_of_PrevInst="${progressDir}/nextInputCmd__try__${numCurrentTry}__instance__${numPrevInstance}.list" |
---|
| 277 | if [ ! -e $nextInputCmd_of_PrevInst ] |
---|
| 278 | then |
---|
| 279 | echo "Le fichier suivant :" >> $badFailureFile |
---|
| 280 | echo "$nextInputCmd_of_PrevInst" >> $badFailureFile |
---|
| 281 | echo "n'existe pas. Il devrait exister. STOP." >> $badFailureFile |
---|
| 282 | exit 1 |
---|
| 283 | fi |
---|
| 284 | cat $nextInputCmd_of_PrevInst > ${inputCmd} |
---|
| 285 | |
---|
| 286 | else # numNewInstance == 1 |
---|
| 287 | numPrevTry=$(( $numCurrentTry - 1 )) |
---|
| 288 | # echo "numCurrentTry=$numCurrentTry" >> $badFailureFile # a virer |
---|
| 289 | # echo "numPrevTry=$numPrevTry" >> $badFailureFile # a virer |
---|
| 290 | # exit 1 # a virer |
---|
| 291 | numLastInstInstanceInPrevTry=$( getNumeroOfLastInstance $numPrevTry ) |
---|
| 292 | noInterruptFile="${progressDir}/noInterrupt__try__${numPrevTry}__instance__${numLastInstInstanceInPrevTry}.txt" |
---|
| 293 | if [ ! -e $noInterruptFile ] |
---|
| 294 | then |
---|
| 295 | # il y a eu interruption non prevue au dernier essai, il faut recomposer la liste des cmds avec les resultats |
---|
| 296 | # de l'essai precedent, derniere instance |
---|
| 297 | prevProgressDir="${USER_OUTPUT_PROGRESS}/TRY__${numPrevTry}" |
---|
| 298 | nextInputCmd_of_LastInst="${prevProgressDir}/nextInputCmd__try__${numPrevTry}__instance__${numLastInstInstanceInPrevTry}.list" |
---|
| 299 | output_of_LastInst="${prevProgressDir}/packOutput__try__${numPrevTry}__instance__${numLastInstInstanceInPrevTry}.log" |
---|
| 300 | inputCmd_of_LastInst="${prevProgressDir}/inputCmd__try__${numPrevTry}__instance__${numLastInstInstanceInPrevTry}.list" |
---|
| 301 | if [ ! -e $output_of_LastInst ] || [ ! -e $inputCmd_of_LastInst ] |
---|
| 302 | then |
---|
| 303 | echo "Les fichiers suivants :" >> $badFailureFile |
---|
| 304 | echo "$output_of_LastInst" >> $badFailureFile |
---|
| 305 | echo "$inputCmd_of_LastInst" >> $badFailureFile |
---|
| 306 | echo "n'existent pas. Il devrait exister. STOP." >> $badFailureFile |
---|
| 307 | exit 1 |
---|
| 308 | fi |
---|
| 309 | |
---|
| 310 | update_tasks_list ${nextInputCmd_of_LastInst} ${output_of_LastInst} ${inputCmd_of_LastInst} |
---|
| 311 | cat $nextInputCmd_of_LastInst > ${inputCmd} |
---|
| 312 | else |
---|
| 313 | nextInputCmd_of_LastInst="${progressDir}/nextInputCmd__try__${numPrevTry}__instance__${numLastInstInstanceInPrevTry}.list" |
---|
| 314 | if [ ! -e $nextInputCmd_of_LastInst ] |
---|
| 315 | then |
---|
| 316 | echo "Le fichier suivant :" >> $badFailureFile |
---|
| 317 | echo "$nextInputCmd_of_LastInst" >> $badFailureFile |
---|
| 318 | echo "n'existe pas. Il devrait exister. STOP." >> $badFailureFile |
---|
| 319 | exit 1 |
---|
| 320 | fi |
---|
| 321 | cat $nextInputCmd_of_LastInst > ${inputCmd} |
---|
| 322 | fi |
---|
| 323 | |
---|
| 324 | fi |
---|
| 325 | fi |
---|
[1849] | 326 | |
---|
[1853] | 327 | # Initialisation du rapport : par defaut, les calculs ont ete interrompus |
---|
| 328 | echo "No report. Le computation must have interrupted." > $reportFile |
---|
[1849] | 329 | |
---|
[1853] | 330 | # exit 0 # a virer |
---|
[1849] | 331 | |
---|
[1853] | 332 | # a virer ######################################### |
---|
[1863] | 333 | if [ ${numNewInstance} -ge 10 ] |
---|
| 334 | then |
---|
| 335 | echo >> $badFailureFile |
---|
| 336 | echo "10eme instance. STOP." >> $badFailureFile |
---|
| 337 | exit 1 |
---|
| 338 | fi |
---|
[1853] | 339 | ################################################### |
---|
[1862] | 340 | # startTime=$( getDateMilliSeconds ) # suppr |
---|
| 341 | # echo "start time:$startTime" >> $timeHandlingFile # suppr |
---|
| 342 | > $timeEndFile # added |
---|
[1849] | 343 | |
---|
[1853] | 344 | ccc_mprun ./glost_launch -R $timeLimitBeforeEnd ${inputCmd} 2>${output} |
---|
[1849] | 345 | |
---|
[1853] | 346 | ### ccc_mprun ./cmd_launch.exe ${inputCmd} 2>${output} |
---|
| 347 | |
---|
| 348 | ### ./cmd_launch.exe ${inputCmd} 2>${output} |
---|
| 349 | ### ccc_mprun -p standard -n ${BRIDGE_MSUB_NPROC} ./cmd_launch.exe ${inputCmd} 2>myIO/output.log |
---|
| 350 | ### mpirun -n 4 ./cmd_launch.exe myIO/inputCmd10.list 2>myIO/output.log |
---|
| 351 | |
---|
[1862] | 352 | # meantime=$( getTimeDiffSeconds $startTime ) # suppr |
---|
[1849] | 353 | |
---|
| 354 | endExecutionTime=$( getDateMilliSeconds ) |
---|
[1862] | 355 | echo "end time:$endExecutionTime" >> $timeEndFile |
---|
[1849] | 356 | |
---|
| 357 | |
---|
[1862] | 358 | |
---|
| 359 | # echo "meantime ncrcat = $meantime" |
---|
| 360 | |
---|
[1853] | 361 | # exit 0 # a virer |
---|
| 362 | |
---|
| 363 | # Gestion des reprises : |
---|
| 364 | # -------------------- |
---|
| 365 | |
---|
| 366 | update_report |
---|
| 367 | |
---|
| 368 | update_tasks_list $nextInputCmd $output $inputCmd |
---|
| 369 | |
---|
[1864] | 370 | # Verifications sur qq listes (dont le traitement semble correct) : |
---|
| 371 | # ---------------------------------------------------------------------------------------- |
---|
| 372 | if [ "x${nbListsToCheck}" == "x" ] |
---|
| 373 | then |
---|
| 374 | echo "nbre de listes a checker absent" >> $checkFile |
---|
| 375 | echo "nbre de listes a checker absent" >> $badFailureFile |
---|
| 376 | exit 1 |
---|
| 377 | fi |
---|
| 378 | > $checkFileTmp |
---|
| 379 | # ensemble des listes concatenees correctement |
---|
| 380 | set_of_good_lists=`cat $output | grep -e '^#executed by process' | awk '{ if ($9==0){print $12} }' | grep "output_ncrcat" ` |
---|
| 381 | |
---|
| 382 | # envoi des cmds de check dans fichier tmp |
---|
| 383 | for lst in $set_of_good_lists |
---|
| 384 | do |
---|
| 385 | echo "./check_ncrcat_list.sh $lst" >> $checkFileTmp |
---|
| 386 | done |
---|
| 387 | |
---|
| 388 | # nombre de listes concatenees correctement |
---|
| 389 | nb_of_good_lists=`cat $checkFileTmp | wc -l ` |
---|
| 390 | |
---|
| 391 | # le nb de listes a checker ne peut exceder le nb de listes disponibles pour le check |
---|
| 392 | if [ $nbListsToCheck -ge $nb_of_good_lists ] |
---|
| 393 | then |
---|
| 394 | nbListsToCheck=$nb_of_good_lists |
---|
| 395 | fi |
---|
| 396 | nbLstToCheck_tmp=$nbListsToCheck |
---|
| 397 | |
---|
| 398 | while [ $nbLstToCheck_tmp -gt 0 ] |
---|
| 399 | do |
---|
| 400 | random_number=$( gives_random_number $nbLstToCheck_tmp ) # nb aleatoire entre 1 et $nbLstToCheck_tmp |
---|
| 401 | checkCmd=`sed -n "${random_number}p" $checkFileTmp ` |
---|
| 402 | $checkCmd # on envoie la cmd de check |
---|
| 403 | resCmd=$? |
---|
| 404 | if [ "x${resCmd}" != "x0" ] |
---|
| 405 | then |
---|
| 406 | echo "$checkCmd ==> not OK ==> stop everything." >> $checkFile |
---|
| 407 | echo "$checkCmd ==> not OK ==> stop everything." >> $badFailureFile |
---|
| 408 | # exit 1 # a retablir |
---|
| 409 | else |
---|
| 410 | echo "$checkCmd ==> OK" >> $checkFile |
---|
| 411 | fi |
---|
| 412 | sed -i "${random_number}d" $checkFileTmp # on retire la cmd qui vient d'etre effectuee du fichier tmp |
---|
| 413 | nbLstToCheck_tmp=$(( $nbLstToCheck_tmp - 1 )) |
---|
| 414 | done |
---|
| 415 | |
---|
| 416 | |
---|
| 417 | rm $checkFileTmp |
---|
| 418 | # ----- Fin verif ------------------------------------------------------------------------ |
---|
| 419 | |
---|
[1853] | 420 | echo "no interruption has occured" > ${noInterruptFile} |
---|
| 421 | |
---|
[1864] | 422 | # exit 0 # a virer |
---|
| 423 | |
---|
[1853] | 424 | # Tout s'est bien passe |
---|
| 425 | # ---------------------- |
---|
| 426 | everythingOK=`cat $nextInputCmd | wc -l ` |
---|
[1864] | 427 | if [ "x${everythingOK}" == "x0" ] |
---|
[1853] | 428 | then |
---|
| 429 | echo "Tout s'est fini correctement" >> $badFailureFile |
---|
[1864] | 430 | exit 0 |
---|
[1853] | 431 | fi |
---|
| 432 | |
---|
| 433 | # y a t il progression ? |
---|
| 434 | # ---------------------- |
---|
| 435 | resDiff=$( check_progress $inputCmd $nextInputCmd ) |
---|
| 436 | # resDiff == 1 : fichiers differents |
---|
| 437 | # resDiff == 0 : fichiers identiques |
---|
| 438 | if [ "x${resDiff}" == "x0" ] |
---|
| 439 | then |
---|
| 440 | echo "Il n'y pas plus de progression" >> $badFailureFile |
---|
| 441 | exit 1 |
---|
| 442 | fi |
---|
| 443 | |
---|
| 444 | # On enchaine avec le meme script |
---|
| 445 | ccc_msub launch_and_measureTime.sh |
---|