Changeset 544 for trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh
- Timestamp:
- 12/22/11 16:04:47 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh
r538 r544 68 68 typeset LOGIN=${LOGIN:=$( whoami )} 69 69 # $hostname of the MASTER job 70 typeset MASTER=titane 100070 typeset MASTER=titane 71 71 72 72 #D- … … 113 113 typeset -r ARCHIVE=${DMFDIR} 114 114 115 # ============ CESIUM START ============ # 116 115 117 #==================================================== 116 118 #- Mirror libIGCM from titane to cesium if needed 117 ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $2}' )118 if [ ! ${ROOTSYS} = "home" ] ; then119 120 else121 122 fi119 #ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $3}' ) 120 #if [ ! ${ROOTSYS} = "home" ] ; then 121 # typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true} 122 #else 123 # typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} 124 #fi 123 125 124 126 #==================================================== 125 127 #- libIGCM_POST 126 if ( ${MirrorlibIGCM} ) ; then 127 PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" ) 128 typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM 129 else 130 typeset -r libIGCM_POST=${libIGCM} 131 fi 128 #if ( ${MirrorlibIGCM} ) ; then 129 # PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" ) 130 # typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM 131 #else 132 # typeset -r libIGCM_POST=${libIGCM} 133 #fi 134 135 # ============ CESIUM END ============ # 136 137 #==================================================== 138 #- MirrorlibIGCM for frontend 139 typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} 140 141 #==================================================== 142 #- libIGCM_POST for frontend 143 typeset -r libIGCM_POST=${libIGCM} 132 144 133 145 #==================================================== … … 137 149 138 150 #==================================================== 139 #- OUT151 #- R_OUT 140 152 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT 141 153 142 154 #==================================================== 143 #- OUT_SCR (ONLY FOR double copy an scratch) 144 typeset -r R_OUT_SCR=${SCRATCHDIR}/IGCM_OUT 155 #- R_BUF (ONLY FOR double copy an scratch) 156 typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT 157 158 #==================================================== 159 #- BIG_DIR : BIG_DIR to store files waiting for rebuild 160 typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD} 145 161 146 162 #==================================================== … … 151 167 #- RUN_DIR_PATH : Temporary working directory (=> TMP) 152 168 if [ ! X${LSB_QUEUE} = Xmono ] ; then 153 169 typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/RUN_DIR/${LSB_JOBID}} 154 170 else 155 171 typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/TMPDIR_IGCM/${LSB_JOBID}} 156 172 fi 157 158 #====================================================159 #- BIG_DIR : BIG_DIR to store files waiting for rebuild160 typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}161 173 162 174 #==================================================== … … 174 186 #D- 175 187 function IGCM_sys_RshMaster { 176 177 ssh -t ${MASTER}/bin/ksh <<-EOF188 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 189 /bin/ksh <<-EOF 178 190 export libIGCM=${libIGCM} 179 191 export DEBUG_debug=${DEBUG_debug} … … 182 194 ${@} 183 195 EOF 184 185 186 187 188 196 if [ $? -gt 0 ] ; then 197 echo "IGCM_sys_RshMaster : erreur." 198 IGCM_debug_Exit "IGCM_sys_RshMaster" 199 fi 200 IGCM_debug_PopStack "IGCM_sys_RshMaster" 189 201 } 190 202 … … 195 207 #D- 196 208 function IGCM_sys_RshArchive { 197 198 209 IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 210 /bin/ksh <<-EOF 199 211 ${@} 200 212 EOF 201 202 203 204 205 213 if [ $? -gt 0 ] ; then 214 echo "IGCM_sys_RshArchive : erreur." 215 IGCM_debug_Exit "IGCM_sys_RshArchive" 216 fi 217 IGCM_debug_PopStack "IGCM_sys_RshArchive" 206 218 } 207 219 … … 212 224 #D- 213 225 function IGCM_sys_RshPost { 214 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 215 if ( $DEBUG_sys ) ; then 216 echo "IGCM_sys_RshPost :" $@ 217 fi 218 219 typeset NB_ESSAI DELAI status i 220 # keep standard input for the loop onto temporary file 221 cat >tmp_IGCM_sys_RshPost_$$ 222 223 #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL 224 #cat tmp_IGCM_sys_RshPost_$$ 225 226 if [ "X$( grep rebuild_from tmp_IGCM_sys_RshPost_$$ )" != "X" ] ; then 227 # little hack so that rebuild submission is done on titane not an cesium 228 # 229 libIGCM_POST_sed=$( echo $libIGCM_POST | sed 's/\//\\\//g' ) 230 POST_DIR_sed=$( echo ${POST_DIR} | sed 's/\//\\\//g' ) 231 sed "s/IGCM_sys_QsubPost/IGCM_sys_Qsub/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt 232 sed "s/ rebuild_fromWorkdir/ ${libIGCM_POST_sed}\/rebuild_fromWorkdir.job/g" tmp.txt > tmp_IGCM_sys_RshPost_$$ 233 sed "s/ rebuild_fromArchive/ ${libIGCM_POST_sed}\/rebuild_fromArchive.job/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt 234 sed "s/Script_Post_Output=/Script_Output=${POST_DIR_sed}\//g" tmp.txt > tmp_IGCM_sys_RshPost_$$ 235 #\mv tmp.txt tmp_IGCM_sys_RshPost_$$ 236 # 237 #echo cat tmp_IGCM_sys_RshPost_$$ AFTER 238 #cat tmp_IGCM_sys_RshPost_$$ 239 /bin/ksh <tmp_IGCM_sys_RshPost_$$ 240 if [ $? -gt 0 ] ; then 241 echo "IGCM_sys_RshPost : erreur." 242 IGCM_debug_Exit "IGCM_sys_RshPost" 243 fi 244 # delete temporary file 245 \rm tmp_IGCM_sys_RshPost_$$ 246 else 247 # number of tentative 248 NB_ESSAI=10 249 # time delay between tentative 250 DELAI=10 251 i=0 252 while [ $i -ne $NB_ESSAI ] ; do 253 ssh -t titane996 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$ 254 status=$? 255 if [ ${status} -ne 0 ]; 256 then 257 sleep $DELAI 258 else 259 break 260 fi 261 let i=$i+1 262 done 263 # delete temporary file 264 \rm tmp_IGCM_sys_RshPost_$$ 265 266 if [ ${status} -gt 0 ] ; then 267 echo "IGCM_sys_RshPost : erreur." 268 IGCM_debug_Exit "IGCM_sys_RshPost" 269 fi 270 fi 271 IGCM_debug_PopStack "IGCM_sys_RshPost" 226 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 227 if ( $DEBUG_sys ) ; then 228 echo "IGCM_sys_RshPost :" $@ 229 fi 230 231 #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL 232 #cat tmp_IGCM_sys_RshPost_$$ 233 # keep standard input (stdin) for the loop onto temporary file 234 cat >tmp_IGCM_sys_RshPost_$$ 235 236 # ============ FRONTEND START ============ # 237 238 /bin/ksh <tmp_IGCM_sys_RshPost_$$ 239 if [ $? -gt 0 ] ; then 240 echo "IGCM_sys_RshPost : erreur." 241 IGCM_debug_Exit "IGCM_sys_RshPost" 242 fi 243 # delete temporary file 244 \rm tmp_IGCM_sys_RshPost_$$ 245 246 # ============ FRONTEND END ============ # 247 248 # ============ CESIUM START ============ # 249 # typeset NB_ESSAI DELAI status i 250 # if [ "X$( grep rebuild_from tmp_IGCM_sys_RshPost_$$ )" != "X" ] ; then 251 # #little hack so that rebuild submission is done on titane not an cesium 252 # 253 # libIGCM_POST_sed=$( echo $libIGCM_POST | sed 's/\//\\\//g' ) 254 # POST_DIR_sed=$( echo ${POST_DIR} | sed 's/\//\\\//g' ) 255 # sed "s/IGCM_sys_QsubPost/IGCM_sys_Qsub/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt 256 # sed "s/ rebuild_fromWorkdir/ ${libIGCM_POST_sed}\/rebuild_fromWorkdir.job/g" tmp.txt > tmp_IGCM_sys_RshPost_$$ 257 # sed "s/ rebuild_fromArchive/ ${libIGCM_POST_sed}\/rebuild_fromArchive.job/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt 258 # sed "s/Script_Post_Output=/Script_Output=${POST_DIR_sed}\//g" tmp.txt > tmp_IGCM_sys_RshPost_$$ 259 # \mv tmp.txt tmp_IGCM_sys_RshPost_$$ 260 # 261 # echo cat tmp_IGCM_sys_RshPost_$$ AFTER 262 # cat tmp_IGCM_sys_RshPost_$$ 263 # 264 # /bin/ksh <tmp_IGCM_sys_RshPost_$$ 265 # if [ $? -gt 0 ] ; then 266 # echo "IGCM_sys_RshPost : erreur." 267 # IGCM_debug_Exit "IGCM_sys_RshPost" 268 # fi 269 # # delete temporary file 270 # \rm tmp_IGCM_sys_RshPost_$$ 271 # 272 # else 273 # # number of tentative 274 # NB_ESSAI=10 275 # # time delay between tentative 276 # DELAI=10 277 # i=0 278 # while [ $i -ne $NB_ESSAI ] ; do 279 # ssh -t titane996 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$ 280 # status=$? 281 # if [ ${status} -ne 0 ]; 282 # then 283 # sleep $DELAI 284 # else 285 # break 286 # fi 287 # let i=$i+1 288 # done 289 # # delete temporary file 290 # \rm tmp_IGCM_sys_RshPost_$$ 291 # 292 # if [ ${status} -gt 0 ] ; then 293 # echo "IGCM_sys_RshPost : erreur." 294 # IGCM_debug_Exit "IGCM_sys_RshPost" 295 # fi 296 # fi 297 298 # ============ CESIUM END ============ # 299 300 IGCM_debug_PopStack "IGCM_sys_RshPost" 272 301 } 273 302 … … 278 307 #D- 279 308 function IGCM_sys_SendMail { 280 281 282 283 284 285 286 287 288 289 290 291 309 IGCM_debug_PushStack "IGCM_sys_SendMail" $@ 310 if ( $DEBUG_sys ) ; then 311 echo "IGCM_sys_SendMail :" $@ 312 fi 313 314 if ( ${ExitFlag} ) ; then 315 status=failed 316 else 317 status=completed 318 fi 319 320 ssh -t titane996 ssh platine /bin/ksh <<-EOF 292 321 export LOGIN=${LOGIN} 293 322 export config_UserChoices_JobName=${config_UserChoices_JobName} … … 314 343 mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 315 344 fi 316 317 345 sleep 10 318 346 rm -f job_end.mail 319 347 EOF 320 348 321 322 323 324 325 349 if [ $? -gt 0 ] ; then 350 echo "IGCM_sys_SendMail : erreur." 351 IGCM_debug_Exit "IGCM_sys_SendMail" 352 fi 353 IGCM_debug_PopStack "IGCM_sys_SendMail" 326 354 } 327 355 … … 332 360 #D- 333 361 function IGCM_sys_Mkdir { 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 362 IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ 363 if ( $DEBUG_sys ) ; then 364 echo "IGCM_sys_Mkdir :" $@ 365 fi 366 if [ ! -d ${1} ]; then 367 \mkdir -p $1 368 if [ $? -gt 0 ] ; then 369 echo "IGCM_sys_Mkdir : erreur." 370 IGCM_debug_Exit "IGCM_sys_Mkdir" 371 fi 372 fi 373 # vérification : 374 if [ ! -d ${1} ] ; then 375 echo "IGCM_sys_Mkdir : erreur." 376 IGCM_debug_Exit "IGCM_sys_Mkdir" 377 fi 378 IGCM_debug_PopStack "IGCM_sys_Mkdir" 351 379 } 352 380 … … 357 385 #D- 358 386 function IGCM_sys_MkdirArchive { 359 360 361 362 363 364 365 366 367 368 369 370 371 387 IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ 388 if ( $DEBUG_sys ) ; then 389 echo "IGCM_sys_MkdirArchive :" $@ 390 fi 391 #- creation de repertoire sur le serveur fichier 392 if [ ! -d ${1} ]; then 393 \mkdir -p $1 394 if [ $? -gt 0 ] ; then 395 echo "IGCM_sys_MkdirArchive : erreur." 396 IGCM_debug_Exit "IGCM_sys_MkdirArchive" 397 fi 398 fi 399 IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 372 400 } 373 401 … … 378 406 #D- 379 407 function IGCM_sys_MkdirWork { 380 381 382 383 384 385 386 387 388 389 390 391 392 408 IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ 409 if ( $DEBUG_sys ) ; then 410 echo "IGCM_sys_MkdirWork :" $@ 411 fi 412 #- creation de repertoire sur le serveur fichier 413 if [ ! -d ${1} ]; then 414 \mkdir -p $1 415 if [ $? -gt 0 ] ; then 416 echo "IGCM_sys_MkdirWork : erreur." 417 IGCM_debug_Exit "IGCM_sys_MkdirWork" 418 fi 419 fi 420 IGCM_debug_PopStack "IGCM_sys_MkdirWork" 393 421 } 394 422 … … 399 427 #D- 400 428 function IGCM_sys_Cd { 401 402 403 404 405 406 407 408 409 410 429 IGCM_debug_PushStack "IGCM_sys_Cd" $@ 430 if ( $DEBUG_sys ) ; then 431 echo "IGCM_sys_Cd :" $@ 432 fi 433 \cd $1 434 if [ $? -gt 0 ] ; then 435 echo "IGCM_sys_Cd : erreur." 436 IGCM_debug_Exit "IGCM_sys_Cd" 437 fi 438 IGCM_debug_PopStack "IGCM_sys_Cd" 411 439 } 412 440 … … 417 445 #D- 418 446 function IGCM_sys_Chmod { 419 420 421 422 423 424 425 426 427 428 429 430 431 432 447 IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@ 448 if ( $DEBUG_sys ) ; then 449 echo "IGCM_sys_Chmod :" $@ 450 fi 451 if [ $DRYRUN -le 1 ]; then 452 \chmod $@ 453 if [ $? -gt 0 ] ; then 454 echo "IGCM_sys_Chmod : erreur." 455 IGCM_debug_Exit "IGCM_sys_Chmod" 456 fi 457 else 458 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 459 fi 460 IGCM_debug_PopStack "IGCM_sys_Chmod" 433 461 } 434 462 … … 439 467 #D- 440 468 function IGCM_sys_FileSize { 441 442 443 444 445 446 447 448 449 450 469 IGCM_debug_PushStack "IGCM_sys_FileSize" $@ 470 471 typeset sizeF 472 set +A sizeF -- $( ls -la ${1} ) 473 if [ $? -gt 0 ] ; then 474 IGCM_debug_Exit "IGCM_sys_FileSize" 475 fi 476 eval ${2}=${sizeF[4]} 477 478 IGCM_debug_PopStack "IGCM_sys_FileSize" 451 479 } 452 480 … … 457 485 #D- 458 486 function IGCM_sys_TestDir { 459 460 461 462 463 464 465 466 467 487 IGCM_debug_PushStack "IGCM_sys_TestDir" $@ 488 if ( $DEBUG_sys ) ; then 489 echo "IGCM_sys_TestDir :" $@ 490 fi 491 typeset ExistFlag 492 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 493 IGCM_debug_PopStack "IGCM_sys_TestDir" 494 495 return ${ExistFlag} 468 496 } 469 497 … … 474 502 #D- 475 503 function IGCM_sys_TestDirArchive { 476 477 478 479 480 481 482 483 484 504 IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ 505 if ( $DEBUG_sys ) ; then 506 echo "IGCM_sys_TestDirArchive :" $@ 507 fi 508 typeset ExistFlag 509 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 510 IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 511 512 return ${ExistFlag} 485 513 } 486 514 … … 491 519 #D- 492 520 function IGCM_sys_TestFileArchive { 493 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 494 typeset ExistFlag 495 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 496 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 497 498 return ${ExistFlag} 521 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 522 if ( $DEBUG_sys ) ; then 523 echo "IGCM_sys_TestFileArchive :" $@ 524 fi 525 typeset ExistFlag 526 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 527 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 528 529 return ${ExistFlag} 530 } 531 532 #D-#================================================== 533 #D-function IGCM_sys_TestFileBuffer 534 #D-* Purpose: Test file that must NOT EXISTS on Buffer 535 #D-* Examples: 536 #D- 537 function IGCM_sys_TestFileBuffer { 538 IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ 539 typeset ExistFlag 540 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 541 IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" 542 543 return ${ExistFlag} 499 544 } 500 545 … … 505 550 #D- 506 551 function IGCM_sys_CountFileArchive { 507 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 508 ls ${@} 2>/dev/null | wc -l 509 if [ $? -gt 0 ] ; then 510 echo "IGCM_sys_CountFileArchive : erreur." 511 fi 512 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 552 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 553 ls ${@} 2>/dev/null | wc -l 554 if [ $? -gt 0 ] ; then 555 echo "IGCM_sys_CountFileArchive : erreur." 556 fi 557 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 558 } 559 560 #D-#================================================== 561 #D-function IGCM_sys_CountFileBuffer 562 #D-* Purpose: Count files on Scratch filesystem 563 #D-* Examples: 564 #D- 565 function IGCM_sys_CountFileBuffer { 566 IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ 567 ls ${@} 2>/dev/null | wc -l 568 if [ $? -gt 0 ] ; then 569 echo "IGCM_sys_CountFileBuffer : erreur." 570 fi 571 IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" 513 572 } 514 573 … … 519 578 #D- 520 579 function IGCM_sys_Tree { 521 522 523 524 525 526 527 528 580 IGCM_debug_PushStack "IGCM_sys_Tree" $@ 581 if ( $DEBUG_sys ) ; then 582 echo "IGCM_sys_Tree :" $@ 583 fi 584 585 \ls -lR ${@} 586 587 IGCM_debug_PopStack "IGCM_sys_Tree" 529 588 } 530 589 531 590 #D-#================================================== 532 591 #D-function IGCM_sys_Tar 533 #D-* Purpose: master un-tar command592 #D-* Purpose: master tar command 534 593 #D-* Examples: 535 594 #D- 536 595 function IGCM_sys_Tar { 537 538 539 540 541 542 543 544 545 546 596 IGCM_debug_PushStack "IGCM_sys_Tar" $@ 597 if ( $DEBUG_sys ) ; then 598 echo "IGCM_sys_Tar :" $@ 599 fi 600 \tar cf $@ 601 if [ $? -gt 0 ] ; then 602 echo "IGCM_sys_Tar : erreur." 603 IGCM_debug_Exit "IGCM_sys_Tar" 604 fi 605 IGCM_debug_PopStack "IGCM_sys_Tar" 547 606 } 548 607 … … 553 612 #D- 554 613 function IGCM_sys_UnTar { 555 556 557 558 559 560 561 562 563 564 614 IGCM_debug_PushStack "IGCM_sys_UnTar" $@ 615 if ( $DEBUG_sys ) ; then 616 echo "IGCM_sys_UnTar :" $@ 617 fi 618 \tar xvf $1 619 if [ $? -gt 0 ] ; then 620 echo "IGCM_sys_UnTar : erreur." 621 IGCM_debug_Exit "IGCM_sys_UnTar" 622 fi 623 IGCM_debug_PopStack "IGCM_sys_UnTar" 565 624 } 566 625 … … 571 630 #D- 572 631 function IGCM_sys_Qsub { 573 IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 574 if ( $DEBUG_sys ) ; then 575 echo "IGCM_sys_Qsub :" $@ 576 fi 577 578 if [ ${config_UserChoices_JobName}.${CumulPeriod} = "." ] ; then 579 /usr/local/bin/ccc_msub -o ${Script_Output} -e ${Script_Output} < $1 580 else 581 /usr/local/bin/ccc_msub -o ${Script_Output} -e ${Script_Output} -r ${config_UserChoices_JobName}.${CumulPeriod} < $1 582 fi 583 584 if [ $? -gt 0 ] ; then 585 echo "IGCM_sys_Qsub : erreur " $@ 586 IGCM_debug_Exit "IGCM_sys_Qsub" 587 fi 588 IGCM_debug_PopStack "IGCM_sys_Qsub" 632 IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 633 if ( $DEBUG_sys ) ; then 634 echo "IGCM_sys_Qsub :" $@ 635 fi 636 typeset options 637 if [ ${config_UserChoices_JobName}.${CumulPeriod} = "." ] ; then 638 options=" -o ${Script_Output} -e ${Script_Output}" 639 else 640 options=" -o ${Script_Output} -e ${Script_Output} -r ${config_UserChoices_JobName}.${CumulPeriod}" 641 fi 642 643 /usr/local/bin/ccc_msub ${options} < $1 644 if [ $? -gt 0 ] ; then 645 echo "IGCM_sys_Qsub : erreur ${options} $1" 646 IGCM_debug_Exit "IGCM_sys_Qsub" 647 fi 648 IGCM_debug_PopStack "IGCM_sys_Qsub" 589 649 } 590 650 … … 595 655 #D- 596 656 function IGCM_sys_QsubPost { 597 IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 598 if ( $DEBUG_sys ) ; then 599 echo "IGCM_sys_QsubPost :" $@ 600 fi 601 /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job 602 if [ $? -gt 0 ] ; then 603 echo "IGCM_sys_QsubPost : erreur " $@ 604 IGCM_debug_Exit "IGCM_sys_QsubPost" 605 fi 606 IGCM_debug_PopStack "IGCM_sys_QsubPost" 657 IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 658 if ( $DEBUG_sys ) ; then 659 echo "IGCM_sys_QsubPost :" $@ 660 fi 661 662 # Need to export listVarEnv for cesium 663 # NO Need to export listVarEnv for titane 664 # ============ FRONTEND START ============ # 665 666 /usr/local/bin/ccc_msub -p ${BRIDGE_MSUB_PROJECT} -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.out ${libIGCM_POST}/$1.job 667 668 # ============ FRONTEND END ============ # 669 670 # ============ CESIUM START ============ # 671 # typeset NB_ESSAI DELAI status i 672 # # number of tentative 673 # NB_ESSAI=10 674 # # time delay between tentative 675 # DELAI=10 676 # (( i = 0 )) 677 # while [ $i -lt $NB_ESSAI ] ; do 678 # /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job 679 # status=$? 680 # if [ ${status} -gt 0 ]; then 681 # sleep $DELAI 682 # else 683 # break 684 # fi 685 # (( i = i + 1 )) 686 # done 687 # ============ CESIUM END ============ # 688 689 if [ $? -gt 0 ] ; then 690 echo "IGCM_sys_QsubPost : erreur " $@ 691 IGCM_debug_Exit "IGCM_sys_QsubPost" 692 fi 693 IGCM_debug_PopStack "IGCM_sys_QsubPost" 607 694 } 608 695 … … 618 705 #D- Error values and explanations can depend on your system version. 619 706 function IGCM_sys_Rsync_out { 620 RET=$1 621 if [ ! $RET ] ; then 622 echo "rsync error !" 623 fi 624 625 if [ $MYLANG = "fr" ]; then 626 case $RET in 627 0) return ;; 628 1) echo "Erreur de rsync ; RERR_SYNTAX : " 629 echo "Erreur de syntaxe ou d'utilisation." 630 return;; 631 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 632 echo "Incompatibilité de protocole." 633 return;; 634 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 635 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 636 echo "répertoires" 637 return;; 638 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 639 echo "Action demandée non supportée : une tentative de manipulation de" 640 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 641 echo "été faite ; ou une option qui est supportée par le client mais" 642 echo "pas par le serveur a été spécifiée." 643 return;; 644 10) echo "Erreur de rsync ; RERR_SOCKETIO" 645 echo "Erreur dans le socket d'entrée sortie" 646 return;; 647 11) echo "Erreur de rsync ; RERR_FILEIO" 648 echo "Erreur d'entrée sortie fichier" 649 return;; 650 12) echo "Erreur de rsync ; RERR_STREAMIO" 651 echo "Erreur dans flux de donnée du protocole rsync" 652 return;; 653 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 654 echo "Erreur avec les diagnostics du programme" 655 return;; 656 14) echo "Erreur de rsync ; RERR_IPC" 657 echo "Erreur dans le code IPC" 658 return;; 659 20) echo "Erreur de rsync ; RERR_SIGNAL" 660 echo "SIGUSR1 ou SIGINT reçu" 661 return;; 662 21) echo "Erreur de rsync ; RERR_WAITCHILD" 663 echo "Une erreur retournée par waitpid()" 664 return;; 665 22) echo "Erreur de rsync ; RERR_MALLOC" 666 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 667 return;; 668 23) echo "" 669 echo "Erreur fichier inexistant" 670 return;; 671 30) echo "Erreur de rsync ; RERR_TIMEOUT" 672 echo "Temps d'attente écoulé dans l'envoi/réception de données" 673 return;; 674 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 675 return;; 676 esac 677 elif [ $MYLANG = "en" ] ; then 678 case $RET in 679 0) return;; 680 1) echo "rsync error : Syntax or usage error " 681 return;; 682 2) echo "rsync error : Protocol incompatibility " 683 return;; 684 3) echo "rsync error : Errors selecting input/output files, dirs" 685 return;; 686 4) echo "rsync error : Requested action not supported: an attempt" 687 echo "was made to manipulate 64-bit files on a platform that cannot support" 688 echo "them; or an option was specified that is supported by the client and" 689 echo "not by the server." 690 return;; 691 5) echo "rsync error : Error starting client-server protocol" 692 return;; 693 10) echo "rsync error : Error in socket I/O " 694 return;; 695 11) echo "rsync error : Error in file I/O " 696 return;; 697 12) echo "rsync error : Error in rsync protocol data stream " 698 return;; 699 13) echo "rsync error : Errors with program diagnostics " 700 return;; 701 14) echo "rsync error : Error in IPC code " 702 return;; 703 20) echo "rsync error : Received SIGUSR1 or SIGINT " 704 return;; 705 21) echo "rsync error : Some error returned by waitpid() " 706 return;; 707 22) echo "rsync error : Error allocating core memory buffers " 708 return;; 709 23) echo "rsync error : Partial transfer due to error" 710 return;; 711 24) echo "rsync error : Partial transfer due to vanished source files" 712 return;; 713 30) echo "rsync error : Timeout in data send/receive " 714 return;; 715 *) echo "rsync error : return code of rsync unknown :" $RET 716 return;; 717 esac 718 else 719 echo "unknown language $MYLANG." 720 return 721 fi 722 } 723 707 RET=$1 708 if [ ! $RET ] ; then 709 echo "rsync error !" 710 fi 711 712 if [ $MYLANG = "fr" ]; then 713 case $RET in 714 0) return ;; 715 1) echo "Erreur de rsync ; RERR_SYNTAX : " 716 echo "Erreur de syntaxe ou d'utilisation." 717 return;; 718 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 719 echo "Incompatibilité de protocole." 720 return;; 721 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 722 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 723 echo "répertoires" 724 return;; 725 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 726 echo "Action demandée non supportée : une tentative de manipulation de" 727 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 728 echo "été faite ; ou une option qui est supportée par le client mais" 729 echo "pas par le serveur a été spécifiée." 730 return;; 731 10) echo "Erreur de rsync ; RERR_SOCKETIO" 732 echo "Erreur dans le socket d'entrée sortie" 733 return;; 734 11) echo "Erreur de rsync ; RERR_FILEIO" 735 echo "Erreur d'entrée sortie fichier" 736 return;; 737 12) echo "Erreur de rsync ; RERR_STREAMIO" 738 echo "Erreur dans flux de donnée du protocole rsync" 739 return;; 740 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 741 echo "Erreur avec les diagnostics du programme" 742 return;; 743 14) echo "Erreur de rsync ; RERR_IPC" 744 echo "Erreur dans le code IPC" 745 return;; 746 20) echo "Erreur de rsync ; RERR_SIGNAL" 747 echo "SIGUSR1 ou SIGINT reçu" 748 return;; 749 21) echo "Erreur de rsync ; RERR_WAITCHILD" 750 echo "Une erreur retournée par waitpid()" 751 return;; 752 22) echo "Erreur de rsync ; RERR_MALLOC" 753 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 754 return;; 755 23) echo "" 756 echo "Erreur fichier inexistant" 757 return;; 758 30) echo "Erreur de rsync ; RERR_TIMEOUT" 759 echo "Temps d'attente écoulé dans l'envoi/réception de données" 760 return;; 761 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 762 return;; 763 esac 764 elif [ $MYLANG = "en" ] ; then 765 case $RET in 766 0) return;; 767 1) echo "rsync error : Syntax or usage error " 768 return;; 769 2) echo "rsync error : Protocol incompatibility " 770 return;; 771 3) echo "rsync error : Errors selecting input/output files, dirs" 772 return;; 773 4) echo "rsync error : Requested action not supported: an attempt" 774 echo "was made to manipulate 64-bit files on a platform that cannot support" 775 echo "them; or an option was specified that is supported by the client and" 776 echo "not by the server." 777 return;; 778 5) echo "rsync error : Error starting client-server protocol" 779 return;; 780 10) echo "rsync error : Error in socket I/O " 781 return;; 782 11) echo "rsync error : Error in file I/O " 783 return;; 784 12) echo "rsync error : Error in rsync protocol data stream " 785 return;; 786 13) echo "rsync error : Errors with program diagnostics " 787 return;; 788 14) echo "rsync error : Error in IPC code " 789 return;; 790 20) echo "rsync error : Received SIGUSR1 or SIGINT " 791 return;; 792 21) echo "rsync error : Some error returned by waitpid() " 793 return;; 794 22) echo "rsync error : Error allocating core memory buffers " 795 return;; 796 23) echo "rsync error : Partial transfer due to error" 797 return;; 798 24) echo "rsync error : Partial transfer due to vanished source files" 799 return;; 800 30) echo "rsync error : Timeout in data send/receive " 801 return;; 802 *) echo "rsync error : return code of rsync unknown :" $RET 803 return;; 804 esac 805 else 806 echo "unknown language $MYLANG." 807 return 808 fi 809 } 724 810 725 811 #D-#================================================== … … 729 815 #D- 730 816 function IGCM_sys_Mirror_libIGCM { 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 817 IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" 818 if ( $DEBUG_sys ) ; then 819 echo "IGCM_sys_Mirror_libIGCM" 820 fi 821 822 typeset RET DEST 823 824 mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} 825 826 echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 827 ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 828 RET=$? 829 830 if [ ${RET} -gt 0 ] ; then 831 echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium." 832 cat out_rsync 833 fi 834 IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" 749 835 } 750 836 … … 752 838 #- Call IGCM_sys_Mirror_libIGCM now ! 753 839 if ( $MirrorlibIGCM ) ; then 754 840 IGCM_sys_Mirror_libIGCM 755 841 fi 756 842 … … 761 847 #D- 762 848 function IGCM_sys_Cp { 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 849 IGCM_debug_PushStack "IGCM_sys_Cp" $@ 850 if ( $DEBUG_sys ) ; then 851 echo "IGCM_sys_Cp :" $@ 852 fi 853 854 typeset RET 855 856 echo cp $@ > out_rsync 2>&1 857 \cp $@ >> out_rsync 2>&1 858 RET=$? 859 860 if [ ${RET} -gt 0 ] ; then 861 echo "IGCM_sys_Cp : error." 862 cat out_rsync 863 IGCM_debug_Exit "IGCM_sys_Cp" 864 else 865 \rm out_rsync 866 fi 867 IGCM_debug_PopStack "IGCM_sys_Cp" 782 868 } 783 869 … … 788 874 #D- 789 875 function IGCM_sys_Rm { 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 876 IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ 877 if ( $DEBUG_sys ) ; then 878 echo "IGCM_sys_Rm :" $@ 879 fi 880 881 typeset RET 882 883 echo rm $@ > out_rsync 2>&1 884 \rm $@ >> out_rsync 2>&1 885 RET=$? 886 887 if [ ${RET} -gt 0 ] ; then 888 echo "IGCM_sys_Rm : error." 889 cat out_rsync 890 IGCM_debug_Exit "IGCM_sys_Rm" 891 else 892 \rm out_rsync 893 fi 894 IGCM_debug_PopStack "IGCM_sys_Rm" 809 895 } 810 896 … … 816 902 #D- 817 903 function IGCM_sys_RmRunDir { 818 IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ 819 if ( $DEBUG_sys ) ; then 820 echo "IGCM_sys_RmRunDir :" $@ 821 fi 822 823 typeset RET 824 825 echo rm $@ > out_rsync 2>&1 826 \rm $@ >> out_rsync 2>&1 827 RET=$? 828 829 if [ ${RET} -gt 0 ] ; then 830 echo "IGCM_sys_RmRunDir : error." 831 cat out_rsync 832 IGCM_debug_Exit "IGCM_sys_RmRunDir" 833 else 834 \rm out_rsync 835 fi 836 837 IGCM_debug_PopStack "IGCM_sys_RmRunDir" 904 IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ 905 if ( $DEBUG_sys ) ; then 906 echo "IGCM_sys_RmRunDir :" $@ 907 fi 908 909 typeset RET 910 911 echo rm $@ > out_rsync 2>&1 912 \rm $@ >> out_rsync 2>&1 913 RET=$? 914 915 if [ ${RET} -gt 0 ] ; then 916 echo "IGCM_sys_RmRunDir : error." 917 cat out_rsync 918 IGCM_debug_Exit "IGCM_sys_RmRunDir" 919 else 920 \rm out_rsync 921 fi 922 IGCM_debug_PopStack "IGCM_sys_RmRunDir" 838 923 } 839 924 … … 844 929 #D- 845 930 function IGCM_sys_Mv { 846 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 847 if ( $DEBUG_sys ) ; then 848 echo "IGCM_sys_Mv :" $@ 849 fi 850 851 if [ $DRYRUN = 0 ]; then 852 853 typeset RET 854 855 echo mv $@ > out_rsync 2>&1 856 \mv $@ >> out_rsync 2>&1 857 RET=$? 931 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 932 if ( $DEBUG_sys ) ; then 933 echo "IGCM_sys_Mv :" $@ 934 fi 935 936 if [ $DRYRUN = 0 ]; then 937 938 typeset RET 858 939 859 if [ ${RET} -gt 0 ] ; then 860 echo "IGCM_sys_Mv : error in mv." 861 cat out_rsync 862 IGCM_debug_Exit "IGCM_sys_Mv" 863 else 864 \rm out_rsync 865 fi 940 echo mv $@ > out_rsync 2>&1 941 \mv $@ >> out_rsync 2>&1 942 RET=$? 943 944 if [ ${RET} -gt 0 ] ; then 945 echo "IGCM_sys_Mv : error in mv." 946 cat out_rsync 947 IGCM_debug_Exit "IGCM_sys_Mv" 866 948 else 867 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 868 fi 869 870 IGCM_debug_PopStack "IGCM_sys_Mv" 949 \rm out_rsync 950 fi 951 else 952 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 953 fi 954 955 IGCM_debug_PopStack "IGCM_sys_Mv" 871 956 } 872 957 … … 877 962 #D- 878 963 function IGCM_sys_Put_Dir { 879 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 880 if ( $DEBUG_sys ) ; then 881 echo "IGCM_sys_Put_Dir :" $@ 882 fi 883 if [ $DRYRUN = 0 ]; then 884 if [ ! -d ${1} ] ; then 885 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 886 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 887 return 888 fi 889 890 typeset RET 891 892 # Only if we use rsync 893 #IGCM_sys_TestDirArchive $( dirname $2 ) 894 # 895 #USUAL WAY 896 \cp -r $1 $2 > out_rsync 2>&1 897 RET=$? 898 899 if [ ${RET} -gt 0 ] ; then 900 echo "IGCM_sys_Put_Dir : error." 901 cat out_rsync 902 IGCM_debug_Exit "IGCM_sys_Put_Dir" 903 else 904 \rm out_rsync 905 fi 964 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 965 if ( $DEBUG_sys ) ; then 966 echo "IGCM_sys_Put_Dir :" $@ 967 fi 968 if [ $DRYRUN = 0 ]; then 969 if [ ! -d ${1} ] ; then 970 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 971 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 972 return 973 fi 974 975 typeset RET 976 977 # Only if we use rsync 978 #IGCM_sys_TestDirArchive $( dirname $2 ) 979 # 980 #USUAL WAY 981 \cp -r $1 $2 > out_rsync 2>&1 982 RET=$? 983 984 if [ ${RET} -gt 0 ] ; then 985 echo "IGCM_sys_Put_Dir : error." 986 cat out_rsync 987 IGCM_debug_Exit "IGCM_sys_Put_Dir" 906 988 else 907 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 908 fi 909 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 989 \rm out_rsync 990 fi 991 else 992 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 993 fi 994 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 910 995 } 911 996 912 997 #D-#================================================== 913 998 #D-function IGCM_sys_Get_Dir 914 #D-* Purpose: Copy a complete directory from $ (ARCHIVE)999 #D-* Purpose: Copy a complete directory from ${ARCHIVE} 915 1000 #D-* Examples: 916 1001 #D- 917 1002 function IGCM_sys_Get_Dir { 918 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 919 if ( $DEBUG_sys ) ; then 920 echo "IGCM_sys_Get_Dir :" $@ 921 fi 922 if [ $DRYRUN = 0 ]; then 923 # if [ ! -d ${1} ] ; then 924 # echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 925 # IGCM_debug_PopStack "IGCM_sys_Get_Dir" 926 # return 927 # fi 928 929 typeset RET 930 931 # Only if we use rsync 932 #IGCM_sys_TestDirArchive $( dirname $2 ) 933 # 934 #USUAL WAY 935 # add dmget (to demigrate all offline files) to reduce time of this command : 936 dmget $1/* 937 \cp -r $1 $2 > out_rsync 2>&1 938 RET=$? 939 940 if [ ${RET} -gt 0 ] ; then 941 echo "IGCM_sys_Get_Dir : error." 942 cat out_rsync 943 IGCM_debug_Exit "IGCM_sys_Get_Dir" 944 else 945 \rm out_rsync 946 fi 1003 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 1004 if ( $DEBUG_sys ) ; then 1005 echo "IGCM_sys_Get_Dir :" $@ 1006 fi 1007 if [ $DRYRUN = 0 ]; then 1008 # if [ ! -d ${1} ] ; then 1009 # echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 1010 # IGCM_debug_PopStack "IGCM_sys_Get_Dir" 1011 # return 1012 # fi 1013 1014 typeset RET 1015 1016 # Only if we use rsync 1017 #IGCM_sys_TestDirArchive $( dirname $2 ) 1018 # 1019 # USUAL WAY 1020 # add dmfind/dmget (to demigrate all offline files) : 1021 dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget 1022 \cp -r $1 $2 > out_rsync 2>&1 1023 RET=$? 1024 1025 if [ ${RET} -gt 0 ] ; then 1026 echo "IGCM_sys_Get_Dir : error." 1027 cat out_rsync 1028 IGCM_debug_Exit "IGCM_sys_Get_Dir" 947 1029 else 948 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 949 fi 950 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 1030 \rm out_rsync 1031 fi 1032 else 1033 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1034 fi 1035 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 951 1036 } 952 1037 … … 957 1042 #D- 958 1043 function IGCM_sys_Get_Master { 959 IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ 960 if ( $DEBUG_sys ) ; then 961 echo "IGCM_sys_Get_Master :" $@ 962 fi 963 if [ $DRYRUN = 0 ]; then 964 if [ ! -d ${1} ] ; then 965 echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." 966 IGCM_debug_PopStack "IGCM_sys_Get_Master" 967 return 968 fi 969 970 typeset RET 971 972 #USUAL WAY 973 \cp -r $1 $2 > out_rsync 2>&1 974 RET=$? 975 976 if [ ${RET} -gt 0 ] ; then 977 echo "IGCM_sys_Get_Master : error." 978 cat out_rsync 979 IGCM_debug_Exit "IGCM_sys_Get_Master" 980 fi 1044 IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ 1045 if ( $DEBUG_sys ) ; then 1046 echo "IGCM_sys_Get_Master :" $@ 1047 fi 1048 if [ $DRYRUN = 0 ]; then 1049 if [ ! -d ${1} ] ; then 1050 echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." 1051 IGCM_debug_PopStack "IGCM_sys_Get_Master" 1052 return 1053 fi 1054 1055 typeset RET 1056 1057 #USUAL WAY 1058 \cp -r $1 $2 > out_rsync 2>&1 1059 RET=$? 1060 1061 if [ ${RET} -gt 0 ] ; then 1062 echo "IGCM_sys_Get_Master : error." 1063 cat out_rsync 1064 IGCM_debug_Exit "IGCM_sys_Get_Master" 981 1065 else 982 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 983 fi 984 IGCM_debug_PopStack "IGCM_sys_Get_Master" 1066 \rm out_rsync 1067 fi 1068 else 1069 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1070 fi 1071 IGCM_debug_PopStack "IGCM_sys_Get_Master" 985 1072 } 986 1073 987 1074 #D-#================================================== 988 1075 #D-function IGCM_sys_Put_Rest 989 #D-* Purpose: Put computied restarts on $ (ARCHIVE).1076 #D-* Purpose: Put computied restarts on ${ARCHIVE}. 990 1077 #D- File and target directory must exist. 991 1078 #D-* Examples: 992 1079 #D- 993 1080 function IGCM_sys_Put_Rest { 994 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 995 if ( $DEBUG_sys ) ; then 996 echo "IGCM_sys_Put_Rest :" $@ 997 fi 998 if [ $DRYRUN = 0 ]; then 999 if [ ! -f ${1} ] ; then 1000 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 1001 IGCM_debug_Exit "IGCM_sys_Put_Rest" 1002 fi 1003 1004 typeset RET 1005 # 1006 if [ X${JobType} = XRUN ] ; then 1007 IGCM_sys_Chmod 444 ${1} 1008 fi 1009 # 1010 IGCM_sys_TestDirArchive $( dirname $2 ) 1011 # 1012 # USUAL WAY 1013 \cp $1 $2 > out_rsync 2>&1 1014 RET=$? 1081 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 1082 if ( $DEBUG_sys ) ; then 1083 echo "IGCM_sys_Put_Rest :" $@ 1084 fi 1085 if [ $DRYRUN = 0 ]; then 1086 if [ ! -f ${1} ] ; then 1087 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 1088 IGCM_debug_Exit "IGCM_sys_Put_Rest" 1089 fi 1090 1091 typeset RET 1092 # 1093 if [ X${JobType} = XRUN ] ; then 1094 IGCM_sys_Chmod 444 ${1} 1095 fi 1096 1097 # 1098 # USUAL WAY 1099 \cp $1 $2 > out_rsync 2>&1 1100 RET=$? 1015 1101 1016 1102 # #RSYNC WITH NETWORK SSH CALL … … 1028 1114 # (( RET=RET+$? )) 1029 1115 1030 if [ ${RET} -gt 0 ] ; then 1031 echo "IGCM_sys_Put_Rest : error." 1032 cat out_rsync 1033 IGCM_debug_Exit "IGCM_sys_Put_Rest" 1034 else 1035 \rm out_rsync 1036 fi 1116 if [ ${RET} -gt 0 ] ; then 1117 echo "IGCM_sys_Put_Rest : error." 1118 cat out_rsync 1119 IGCM_debug_Exit "IGCM_sys_Put_Rest" 1037 1120 else 1038 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1039 fi 1040 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 1121 \rm out_rsync 1122 fi 1123 else 1124 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1125 fi 1126 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 1127 } 1128 1129 #D-#================================================== 1130 #D-function IGCM_sys_PutBuffer_Rest 1131 #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 1132 #D- File and target directory must exist. 1133 #D-* Examples: 1134 #D- 1135 function IGCM_sys_PutBuffer_Rest { 1136 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 1137 if ( $DEBUG_sys ) ; then 1138 echo "IGCM_sys_PutBuffer_Rest :" $@ 1139 fi 1140 if [ $DRYRUN = 0 ]; then 1141 if [ ! -f ${1} ] ; then 1142 echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 1143 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1144 fi 1145 1146 typeset RET 1147 # 1148 if [ X${JobType} = XRUN ] ; then 1149 IGCM_sys_Chmod 444 ${1} 1150 fi 1151 1152 # 1153 # USUAL WAY 1154 \cp $1 $2 > out_rsync 2>&1 1155 RET=$? 1156 1157 if [ ${RET} -gt 0 ] ; then 1158 echo "IGCM_sys_PutBuffer_Rest : error." 1159 cat out_rsync 1160 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1161 else 1162 \rm out_rsync 1163 fi 1164 else 1165 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1166 fi 1167 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" 1041 1168 } 1042 1169 1043 1170 #D-#================================================== 1044 1171 #D-function IGCM_sys_Put_Out 1045 #D-* Purpose: Copy a file on $ (ARCHIVE) after havechmod it in readonly1172 #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly 1046 1173 #D-* Examples: 1047 1174 #D- 1048 1175 function IGCM_sys_Put_Out { 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1176 IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 1177 if ( $DEBUG_sys ) ; then 1178 echo "IGCM_sys_Put_Out :" $@ 1179 fi 1180 if [ $DRYRUN = 0 ]; then 1181 if [ ! -f ${1} ] ; then 1182 echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 1183 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1184 return 1 1185 fi 1186 # 1187 IGCM_sys_MkdirArchive $( dirname $2 ) 1188 # 1189 typeset RET 1190 1191 #===================================================== 1192 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1193 #===================================================== 1194 1195 #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1 1196 #if [ $? -eq 0 ] ; then 1197 # typeset WORKPATH FILEPATH 1198 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 1199 # IGCM_sys_MkdirWork ${WORKPATH} 1200 # FILEPATH=${WORKPATH}/$( basename $2 ) 1201 # # 1202 # IGCM_sys_Cp ${1} ${FILEPATH} 1203 #fi 1204 1205 if [ X${JobType} = XRUN ] ; then 1206 if [ X${3} = X ] ; then 1207 IGCM_sys_Chmod 444 ${1} 1208 fi 1209 fi 1210 # 1211 # USUAL WAY 1212 \cp $1 $2 > out_rsync 2>&1 1213 RET=$? 1087 1214 1088 1215 # #RSYNC WITH NETWORK SSH CALL … … 1100 1227 # (( RET=RET+$? )) 1101 1228 1102 if [ ${RET} -gt 0 ] ; then 1103 echo "IGCM_sys_Put_Out : error." 1104 cat out_rsync 1105 IGCM_debug_Exit "IGCM_sys_Put_Out" 1106 else 1107 \rm out_rsync 1108 fi 1229 if [ ${RET} -gt 0 ] ; then 1230 echo "IGCM_sys_Put_Out : error." 1231 cat out_rsync 1232 IGCM_debug_Exit "IGCM_sys_Put_Out" 1109 1233 else 1110 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1111 fi 1112 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1113 return 0 1234 \rm out_rsync 1235 fi 1236 else 1237 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1238 fi 1239 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1240 return 0 1241 } 1242 1243 #D-#================================================== 1244 #D-function IGCM_sys_PutBuffer_Out 1245 #D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly 1246 #D-* Examples: 1247 #D- 1248 function IGCM_sys_PutBuffer_Out { 1249 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ 1250 if ( $DEBUG_sys ) ; then 1251 echo "IGCM_sys_PutBuffer_Out :" $@ 1252 fi 1253 if [ $DRYRUN = 0 ]; then 1254 if [ ! -f ${1} ] ; then 1255 echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." 1256 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1257 return 1 1258 fi 1259 # 1260 IGCM_sys_Mkdir $( dirname $2 ) 1261 # 1262 typeset RET 1263 1264 if [ X${JobType} = XRUN ] ; then 1265 if [ X${3} = X ] ; then 1266 IGCM_sys_Chmod 444 ${1} 1267 fi 1268 fi 1269 # 1270 # USUAL WAY 1271 \cp $1 $2 > out_rsync 2>&1 1272 RET=$? 1273 1274 if [ ${RET} -gt 0 ] ; then 1275 echo "IGCM_sys_PutBuffer_Out : error." 1276 cat out_rsync 1277 IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 1278 else 1279 \rm out_rsync 1280 fi 1281 else 1282 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1283 fi 1284 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1285 return 0 1114 1286 } 1115 1287 … … 1120 1292 #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ 1121 1293 function IGCM_sys_Get { 1122 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1123 1124 typeset DEST RET dm_liste ifile target file_work 1125 1126 if ( $DEBUG_sys ) ; then 1127 echo "IGCM_sys_Get :" $@ 1128 fi 1129 if [ $DRYRUN -le 2 ]; then 1130 if [ X${1} = X'/l' ] ; then 1131 # test if the first file is present in the old computation : 1132 eval set +A dm_liste \${${2}} 1133 else 1134 eval set +A dm_liste ${1} 1135 fi 1136 eval DEST=\${${#}} 1137 1138 #===================================================== 1139 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1140 #===================================================== 1141 1142 # Is it an R_OUT file (not R_IN) ? 1143 #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 1144 #if [ $? -eq 0 ] ; then 1145 # # Yes ? then we try to get it in SCRATCHDIR 1146 # set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|g" ) 1147 # if [ -f ${file_work[0]} ] ; then 1148 # IGCM_sys_Cp ${file_work[*]} ${DEST} 1149 # IGCM_debug_PopStack "IGCM_sys_Get" 1150 # return 1151 # fi 1152 #fi 1153 1154 # test if the (first) file is present in the old computation : 1155 IGCM_sys_TestFileArchive ${dm_liste[0]} 1156 RET=$? 1157 if [ ${RET} -gt 0 ] ; then 1158 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1159 IGCM_debug_Exit "IGCM_sys_Get" 1160 fi 1161 1162 dmget ${dm_liste[*]} > out_rsync 2>&1 1163 RET=$? 1164 1165 if [ ${RET} -gt 0 ] ; then 1166 echo "WARNING IGCM_sys_Get : demigration error." 1167 cat out_rsync 1168 echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 1169 fi 1170 1171 #if [ ${RET} -gt 0 ] ; then 1172 # if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 1173 # cat out_rsync 1174 # echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : " 1175 # sleep 30 1176 # echo "We try another time" 1177 # dmget ${dm_liste[*]} > out_rsync 2>&1 1178 # RET=$? 1179 # if [ ${RET} -gt 0 ] ; then 1180 # echo "ERROR IGCM_sys_Get : again demigration error :" 1181 # cat out_rsync 1182 # IGCM_debug_Exit "IGCM_sys_Get" 1183 # fi 1184 # else 1185 # echo "ERROR IGCM_sys_Get : demigration error :" 1186 # cat out_rsync 1187 # IGCM_debug_Exit "IGCM_sys_Get" 1188 # fi 1189 #fi 1190 1191 #USUAL WAY 1192 if [ X${1} = X'/l' ] ; then 1193 (( RET=0 )) 1194 for target in ${dm_liste[*]} ; do 1195 local_file=$( basename ${target} ) 1196 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1197 (( RET = RET + $? )) 1198 done 1199 else 1200 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1201 RET=$? 1202 fi 1294 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1295 1296 typeset DEST RET dm_liste ifile target file_work 1297 1298 if ( $DEBUG_sys ) ; then 1299 echo "IGCM_sys_Get :" $@ 1300 fi 1301 if [ $DRYRUN -le 2 ]; then 1302 if [ X${1} = X'/l' ] ; then 1303 # test if the first file is present in the old computation : 1304 eval set +A dm_liste \${${2}} 1305 else 1306 eval set +A dm_liste ${1} 1307 fi 1308 eval DEST=\${${#}} 1309 1310 #===================================================== 1311 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR 1312 #===================================================== 1313 1314 # Is it an R_OUT file (not R_IN) ? 1315 #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 1316 #if [ $? -eq 0 ] ; then 1317 # # Yes ? then we try to get it in SCRATCHDIR 1318 # set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_BUF}|g" ) 1319 # if [ -f ${file_work[0]} ] ; then 1320 # IGCM_sys_Cp ${file_work[*]} ${DEST} 1321 # IGCM_debug_PopStack "IGCM_sys_Get" 1322 # return 1323 # fi 1324 #fi 1325 1326 # test if the (first) file is present in the old computation : 1327 IGCM_sys_TestFileArchive ${dm_liste[0]} 1328 RET=$? 1329 if [ ${RET} -gt 0 ] ; then 1330 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1331 IGCM_debug_Exit "IGCM_sys_Get" 1332 fi 1333 1334 dmget ${dm_liste[*]} > out_rsync 2>&1 1335 RET=$? 1336 if [ ${RET} -gt 0 ] ; then 1337 echo "WARNING IGCM_sys_Get : demigration error." 1338 cat out_rsync 1339 echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 1340 fi 1341 1342 #if [ ${RET} -gt 0 ] ; then 1343 # if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 1344 # cat out_rsync 1345 # echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : " 1346 # sleep 30 1347 # echo "We try another time" 1348 # dmget ${dm_liste[*]} > out_rsync 2>&1 1349 # RET=$? 1350 # if [ ${RET} -gt 0 ] ; then 1351 # echo "ERROR IGCM_sys_Get : again demigration error :" 1352 # cat out_rsync 1353 # IGCM_debug_Exit "IGCM_sys_Get" 1354 # fi 1355 # else 1356 # echo "ERROR IGCM_sys_Get : demigration error :" 1357 # cat out_rsync 1358 # IGCM_debug_Exit "IGCM_sys_Get" 1359 # fi 1360 #fi 1361 1362 #USUAL WAY 1363 if [ X${1} = X'/l' ] ; then 1364 (( RET=0 )) 1365 for target in ${dm_liste[*]} ; do 1366 local_file=$( basename ${target} ) 1367 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1368 (( RET = RET + $? )) 1369 done 1370 else 1371 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1372 RET=$? 1373 fi 1203 1374 1204 1375 # #RSYNC WITH NETWORK SSH CALL … … 1216 1387 # (( RET=RET+$? )) 1217 1388 1218 if [ ${RET} -gt 0 ] ; then 1219 echo "IGCM_sys_Get : copy error." 1220 cat out_rsync 1221 IGCM_debug_Exit "IGCM_sys_Get" 1222 else 1223 \rm out_rsync 1224 fi 1389 if [ ${RET} -gt 0 ] ; then 1390 echo "IGCM_sys_Get : copy error." 1391 cat out_rsync 1392 IGCM_debug_Exit "IGCM_sys_Get" 1225 1393 else 1226 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1227 fi 1228 IGCM_debug_PopStack "IGCM_sys_Get" 1394 \rm out_rsync 1395 fi 1396 else 1397 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1398 fi 1399 IGCM_debug_PopStack "IGCM_sys_Get" 1400 } 1401 1402 #D-#================================================== 1403 #D-function IGCM_sys_GetBuffer 1404 #D-* Purpose: Get a file from ${SCRATCHDIR} 1405 #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX 1406 #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ 1407 function IGCM_sys_GetBuffer { 1408 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1409 1410 typeset DEST RET buf_liste ifile target file_work 1411 1412 if ( $DEBUG_sys ) ; then 1413 echo "IGCM_sys_GetBuffer :" $@ 1414 fi 1415 if [ $DRYRUN -le 2 ]; then 1416 if [ X${1} = X'/l' ] ; then 1417 # test if the first file is present in the old computation : 1418 eval set +A buf_liste \${${2}} 1419 else 1420 eval set +A buf_liste ${1} 1421 fi 1422 eval DEST=\${${#}} 1423 1424 #USUAL WAY 1425 if [ X${1} = X'/l' ] ; then 1426 (( RET=0 )) 1427 for target in ${buf_liste[*]} ; do 1428 local_file=$( basename ${target} ) 1429 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1430 (( RET = RET + $? )) 1431 done 1432 else 1433 \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 1434 RET=$? 1435 fi 1436 1437 if [ ${RET} -gt 0 ] ; then 1438 echo "IGCM_sys_GetBuffer : copy error." 1439 cat out_rsync 1440 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1441 else 1442 \rm out_rsync 1443 fi 1444 else 1445 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1446 fi 1447 IGCM_debug_PopStack "IGCM_sys_GetBuffer" 1229 1448 } 1230 1449 … … 1235 1454 #D- 1236 1455 function IGCM_sys_GetDate_FichWork { 1237 1238 1239 1240 1241 1242 1243 1456 IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 1457 if ( $DEBUG_sys ) ; then 1458 echo "IGCM_sys_GetDate_FichWork :" $@ 1459 fi 1460 typeset dateF 1461 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1462 eval ${2}=${dateF[5]} 1244 1463 1245 1464 # donne la date filesys d'un fichier sur la machine work 1246 1465 IGCM_debug_PopStack "IGCM_sys_FichWork" 1247 1466 } 1248 1467 … … 1253 1472 #D- 1254 1473 function IGCM_sys_GetDate_FichArchive { 1255 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1256 if ( $DEBUG_sys ) ; then 1257 echo "IGCM_sys_GetDate_FichArchive :" $@ 1258 fi 1259 typeset dateF 1260 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1261 eval ${2}=${dateF[5]} 1262 1263 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1474 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1475 if ( $DEBUG_sys ) ; then 1476 echo "IGCM_sys_GetDate_FichArchive :" $@ 1477 fi 1478 typeset dateF 1479 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1480 eval ${2}=${dateF[5]} 1481 1482 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1483 } 1484 1485 #D-#================================================== 1486 #D-function IGCM_sys_Dods_Rm 1487 #D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. 1488 #D-* Examples: 1489 #D- 1490 function IGCM_sys_Dods_Rm { 1491 if ( $DEBUG_sys ) ; then 1492 echo "IGCM_sys_Dods_Rm :" $@ 1493 fi 1494 typeset RET 1495 RET=0 1496 if [ $DRYRUN = 0 ]; then 1497 if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then 1498 echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ." 1499 echo "Nothing has been done." 1500 return 1501 fi 1502 dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 1503 RET=$? 1504 1505 # if [ ${RET} -gt 0 ] ; then 1506 # echo "IGCM_sys_Dods_Rm : error." 1507 # cat out_dods_rm 1508 # IGCM_debug_Exit "IGCM_sys_Dods_Rm" 1509 # else 1510 # rm out_dods_rm 1511 # fi 1512 1513 else 1514 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1515 fi 1516 return $RET 1517 } 1518 1519 #D-#================================================== 1520 #D-function IGCM_sys_Dods_Cp 1521 #D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole. 1522 #D-* Examples: 1523 #D- 1524 function IGCM_sys_Dods_Cp { 1525 if ( $DEBUG_sys ) ; then 1526 echo "IGCM_sys_Dods_Cp :" $@ 1527 fi 1528 typeset RET 1529 RET=0 1530 if [ $DRYRUN = 0 ]; then 1531 if [ ! -d ${R_SAVE}/${1} ] ; then 1532 echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ." 1533 echo "Nothing has been done." 1534 return 1535 fi 1536 # 1537 dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1 1538 RET=$? 1539 1540 # if [ ${RET} -gt 0 ] ; then 1541 # echo "IGCM_sys_Dods_Cp : error." 1542 # cat out_dods_cp 1543 # IGCM_debug_Exit "IGCM_sys_Dods_Cp" 1544 # else 1545 # rm out_dods_cp 1546 # fi 1547 1548 else 1549 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1550 fi 1551 return $RET 1552 } 1553 1554 #D-#================================================== 1555 #D-function IGCM_sys_Put_Dods 1556 #D-* Purpose: Put $(ARCHIVE) files on DODS internet protocole. 1557 #D-* Examples: 1558 #D- 1559 function IGCM_sys_Put_Dods { 1560 IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ 1561 if ( $DEBUG_sys ) ; then 1562 echo "IGCM_sys_Put_Dods :" $@ 1563 fi 1564 if [ $DRYRUN = 0 ]; then 1565 if [ ! -d ${R_SAVE}/${1} ] ; then 1566 echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ." 1567 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 1568 return 1569 fi 1570 1571 typeset RET 1572 # 1573 cd ${R_SAVE} 1574 IGCM_sys_Dods_Rm ${1} 1575 IGCM_sys_Dods_Cp ${1} 1576 RET=0 1577 1578 if [ ${RET} -gt 0 ] ; then 1579 echo "IGCM_sys_Put_Dods : error." 1580 IGCM_debug_Exit "IGCM_sys_Put_Dods" 1581 fi 1582 else 1583 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1584 fi 1585 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 1264 1586 } 1265 1587 … … 1268 1590 1269 1591 function IGCM_sys_rebuild { 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1592 IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 1593 if ( $DEBUG_sys ) ; then 1594 echo "IGCM_sys_rebuild :" $@ 1595 fi 1596 /home/cont003/p86ipsl/X64/bin/rebuild -f -o $@ 1597 if [ $? -gt 0 ] ; then 1598 echo "IGCM_sys_rebuild : erreur ${@}." 1599 IGCM_debug_Exit "rebuild" 1600 fi 1601 1602 IGCM_debug_PopStack "IGCM_sys_rebuild" 1281 1603 } 1282 1604 … … 1285 1607 1286 1608 function IGCM_sys_activ_variables { 1287 1288 1289 1290 1291 1292 1609 IGCM_debug_PushStack "IGCM_sys_activ_variables" 1610 if ( $DEBUG_sys ) ; then 1611 echo "IGCM_sys_activ_variables" 1612 fi 1613 ulimit -s 2097152 1614 IGCM_debug_PopStack "IGCM_sys_activ_variables" 1293 1615 } 1294 1616 … … 1297 1619 1298 1620 function IGCM_sys_desactiv_variables { 1299 1300 1301 1302 1303 1621 IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 1622 if ( $DEBUG_sys ) ; then 1623 echo "IGCM_sys_desactiv_variables" 1624 fi 1625 IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 1304 1626 } 1305 1627 … … 1308 1630 1309 1631 function IGCM_sys_build_run_file { 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1632 IGCM_debug_PushStack "IGCM_sys_build_run_file" $@ 1633 if ( $DEBUG_sys ) ; then 1634 echo "IGCM_sys_build_run_file " $@ 1635 fi 1636 1637 # set Number of processors for OCE here 1638 NUM_PROC_OCE=5 1639 1640 (( NUM_PROC_ATM = $BATCH_NUM_PROC_TOT - NUM_PROC_OCE - 1)) 1641 (( nb_tot_m1 = $BATCH_NUM_PROC_TOT - NUM_PROC_OCE )) 1642 if [ $1 = MPI1 ]; then 1643 cat <<EOF > run_file 1322 1644 -np 1 ./oasis 1323 1645 -np ${NUM_PROC_ATM} ./lmdz.x 1324 1646 -np ${NUM_PROC_OCE} ./opa.xx 1325 1647 EOF 1326 1327 1328 1329 1648 config_UserChoices_JobRunOptions='"--app"' 1649 IGCM_sys_Chmod u+x run_file 1650 fi 1651 IGCM_debug_PopStack "IGCM_sys_build_run_file" 1330 1652 1331 1653 } … … 1334 1656 # NCO OPERATOR 1335 1657 1658 function IGCM_sys_ncap2 { 1659 IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 1660 if ( $DEBUG_sys ) ; then 1661 echo "IGCM_sys_ncap2 :" $@ 1662 fi 1663 ncap2 "$@" 1664 if [ $? -gt 0 ] ; then 1665 echo "IGCM_sys_ncap2 : erreur ${@}." 1666 IGCM_debug_Exit "ncap2" 1667 fi 1668 1669 IGCM_debug_PopStack "IGCM_sys_ncap2" 1670 } 1671 1336 1672 function IGCM_sys_ncatted { 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1673 IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 1674 if ( $DEBUG_sys ) ; then 1675 echo "IGCM_sys_ncatted :" $@ 1676 fi 1677 ncatted "$@" 1678 if [ $? -gt 0 ] ; then 1679 echo "IGCM_sys_ncatted : erreur ${@}." 1680 IGCM_debug_Exit "ncatted" 1681 fi 1682 1683 IGCM_debug_PopStack "IGCM_sys_ncatted" 1348 1684 } 1349 1685 1350 1686 function IGCM_sys_ncbo { 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1687 IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 1688 if ( $DEBUG_sys ) ; then 1689 echo "IGCM_sys_ncbo :" $@ 1690 fi 1691 ncbo $@ 1692 if [ $? -gt 0 ] ; then 1693 echo "IGCM_sys_ncbo : erreur ${@}." 1694 IGCM_debug_Exit "ncbo" 1695 fi 1696 1697 IGCM_debug_PopStack "IGCM_sys_ncbo" 1362 1698 } 1363 1699 1364 1700 function IGCM_sys_ncdiff { 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1701 IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 1702 if ( $DEBUG_sys ) ; then 1703 echo "IGCM_sys_ncdiff :" $@ 1704 fi 1705 ncdiff $@ 1706 if [ $? -gt 0 ] ; then 1707 echo "IGCM_sys_ncdiff : erreur ${@}." 1708 IGCM_debug_Exit "ncdiff" 1709 fi 1710 1711 IGCM_debug_PopStack "IGCM_sys_ncdiff" 1376 1712 } 1377 1713 1378 1714 function IGCM_sys_ncea { 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1715 IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 1716 if ( $DEBUG_sys ) ; then 1717 echo "IGCM_sys_ncea :" $@ 1718 fi 1719 ncea $@ 1720 if [ $? -gt 0 ] ; then 1721 echo "IGCM_sys_ncea : erreur ${@}." 1722 IGCM_debug_Exit "ncea" 1723 fi 1724 1725 IGCM_debug_PopStack "IGCM_sys_ncea" 1390 1726 } 1391 1727 1392 1728 function IGCM_sys_ncecat { 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1729 IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 1730 if ( $DEBUG_sys ) ; then 1731 echo "IGCM_sys_ncecat :" $@ 1732 fi 1733 ncecat $@ 1734 if [ $? -gt 0 ] ; then 1735 echo "IGCM_sys_ncecat : erreur ${@}." 1736 IGCM_debug_Exit "ncecat" 1737 fi 1738 1739 IGCM_debug_PopStack "IGCM_sys_ncecat" 1404 1740 } 1405 1741 1406 1742 function IGCM_sys_ncflint { 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1743 IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 1744 if ( $DEBUG_sys ) ; then 1745 echo "IGCM_sys_ncflint :" $@ 1746 fi 1747 ncflint $@ 1748 if [ $? -gt 0 ] ; then 1749 echo "IGCM_sys_ncflint : erreur ${@}." 1750 IGCM_debug_Exit "ncflint" 1751 fi 1752 1753 IGCM_debug_PopStack "IGCM_sys_ncflint" 1418 1754 } 1419 1755 1420 1756 function IGCM_sys_ncks { 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1757 IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 1758 if ( $DEBUG_sys ) ; then 1759 echo "IGCM_sys_ncks :" $@ 1760 fi 1761 ncks $@ 1762 if [ $? -gt 0 ] ; then 1763 echo "IGCM_sys_ncks : erreur ${@}." 1764 IGCM_debug_Exit "ncks" 1765 fi 1766 1767 IGCM_debug_PopStack "IGCM_sys_ncks" 1432 1768 } 1433 1769 1434 1770 function IGCM_sys_ncpdq { 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1771 IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 1772 if ( $DEBUG_sys ) ; then 1773 echo "IGCM_sys_ncpdq :" $@ 1774 fi 1775 ncpdq $@ 1776 if [ $? -gt 0 ] ; then 1777 echo "IGCM_sys_ncpdq : erreur ${@}." 1778 IGCM_debug_Exit "ncpdq" 1779 fi 1780 1781 IGCM_debug_PopStack "IGCM_sys_ncpdq" 1446 1782 } 1447 1783 1448 1784 function IGCM_sys_ncra { 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1785 IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 1786 if ( $DEBUG_sys ) ; then 1787 echo "IGCM_sys_ncra :" $@ 1788 fi 1789 ncra $@ 1790 if [ $? -gt 0 ] ; then 1791 echo "IGCM_sys_ncra : erreur ${@}." 1792 IGCM_debug_Exit "ncra" 1793 fi 1794 1795 IGCM_debug_PopStack "IGCM_sys_ncra" 1460 1796 } 1461 1797 1462 1798 function IGCM_sys_ncrcat { 1463 1464 1465 1466 1467 1468 1469 1799 IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 1800 if ( $DEBUG_sys ) ; then 1801 echo "IGCM_sys_ncrcat :" $@ 1802 fi 1803 ncrcat $@ 1804 if [ $? -gt 0 ] ; then 1805 echo "IGCM_sys_ncrcat : erreur ${@}." 1470 1806 # IGCM_debug_Exit "ncrcat" 1471 1472 1473 1807 fi 1808 1809 IGCM_debug_PopStack "IGCM_sys_ncrcat" 1474 1810 } 1475 1811 1476 1812 function IGCM_sys_ncrename { 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1813 IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 1814 if ( $DEBUG_sys ) ; then 1815 echo "IGCM_sys_ncrename :" $@ 1816 fi 1817 ncrename $@ 1818 if [ $? -gt 0 ] ; then 1819 echo "IGCM_sys_ncrename : erreur ${@}." 1820 IGCM_debug_Exit "ncrename" 1821 fi 1822 1823 IGCM_debug_PopStack "IGCM_sys_ncrename" 1488 1824 } 1489 1825 1490 1826 function IGCM_sys_ncwa { 1491 IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 1492 if ( $DEBUG_sys ) ; then 1493 echo "IGCM_sys_ncwa :" $@ 1494 fi 1495 ncwa $@ 1496 if [ $? -gt 0 ] ; then 1497 echo "IGCM_sys_ncwa : erreur ${@}." 1498 IGCM_debug_Exit "ncwa" 1499 fi 1500 1501 IGCM_debug_PopStack "IGCM_sys_ncwa" 1502 } 1827 IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 1828 if ( $DEBUG_sys ) ; then 1829 echo "IGCM_sys_ncwa :" $@ 1830 fi 1831 ncwa $@ 1832 if [ $? -gt 0 ] ; then 1833 echo "IGCM_sys_ncwa : erreur ${@}." 1834 IGCM_debug_Exit "ncwa" 1835 fi 1836 1837 IGCM_debug_PopStack "IGCM_sys_ncwa" 1838 } 1839 1840 ############################################################## 1841 # CDO OPERATOR 1842 1843 function IGCM_sys_cdo { 1844 IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 1845 if ( $DEBUG_sys ) ; then 1846 echo "IGCM_sys_cdo :" $@ 1847 fi 1848 \cdo $@ 1849 if [ $? -gt 0 ] ; then 1850 echo "IGCM_sys_cdo : erreur ${@}." 1851 IGCM_debug_PopStack "IGCM_sys_cdo" 1852 return 1 1853 else 1854 IGCM_debug_PopStack "IGCM_sys_cdo" 1855 return 0 1856 fi 1857 1858 IGCM_debug_PopStack "IGCM_sys_cdo" 1859 }
Note: See TracChangeset
for help on using the changeset viewer.