Changeset 1013
- Timestamp:
- 07/04/14 12:39:11 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_ada.ksh
r1012 r1013 217 217 function IGCM_sys_RshArchive { 218 218 IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 219 typeset ergonCount gayaCount 219 220 DEBUG_sys=false IGCM_sys_IsFileArchived "$@" 220 221 if [ $? = 0 ] ; then 222 status=0 223 #special case for the find command. Only used together with RshArchive to find tared restart 224 if [ "X$( echo $@ | grep ^find )" != "X" ] ; then 225 # Ergon first 226 rsh ${STOREHOST} exec /bin/ksh <<-EOF > ergonList.txt 227 ${@} 228 EOF 229 (( status=status + $? )) 230 # Gaya turn 231 rsh gaya exec /bin/ksh <<-EOF > gayaList.txt 232 ${@} 233 EOF 234 (( status=status + $? )) 235 236 # the more the better 237 ergonCount=$( cat ergonList.txt | wc -l ) 238 gayaCount=$( cat gayaList.txt | wc -l ) 239 240 [ ${ergonCount} -ge ${gayaCount} ] && cat ergonList.txt || cat gayaList.txt 241 rm -f ergonList.txt gayaList.txt 242 else 221 243 rsh ${STOREHOST} exec /bin/ksh <<-EOF 222 244 ${@} 223 245 EOF 224 246 status=$? 247 fi 225 248 else 226 249 /bin/ksh <<-EOF … … 511 534 #D-* Examples: 512 535 #D- 536 #function IGCM_sys_TestFileArchive { 537 # IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 538 # typeset ExistFlag TempCommandFile 539 # TempCommandFile="[ -f $1 ] && echo 0 || echo 1" 540 # #Command depends on targeted file system 541 # #We want it quiet 542 # DEBUG_sys=false IGCM_sys_IsFileArchived $1 543 # if [ $? = 0 ] ; then 544 # ExistFlag=$( IGCM_sys_RshArchive ${TempCommandFile} ) 545 # else 546 # ExistFlag=$( ${TempCommandFile} ) 547 # fi 548 # IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 549 # 550 # return ${ExistFlag} 551 #} 552 553 #D-#================================================== 554 #D-function IGCM_sys_TestFileArchive 555 #D-* Purpose: Test file that must NOT EXISTS on Archive 556 #D-* Examples: 557 #D- 513 558 function IGCM_sys_TestFileArchive { 514 559 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 515 typeset ExistFlag TempCommandFile 516 TempCommandFile="[ -f $1 ] && echo 0 || echo 1" 517 #Command depends on targeted file system 518 #We want it quiet 519 DEBUG_sys=false IGCM_sys_IsFileArchived $1 520 if [ $? = 0 ] ; then 521 ExistFlag=$( IGCM_sys_RshArchive ${TempCommandFile} ) 522 else 523 ExistFlag=$( ${TempCommandFile} ) 524 fi 560 typeset ExistFlag finalPosition 561 562 finalPosition=$( mfls $1 | wc -l ) 563 [ ${finalPosition} -eq 8 ] && ExistFlag=1 || ExistFlag=0 564 525 565 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 526 566 527 567 return ${ExistFlag} 528 568 } 569 529 570 530 571 #D-#================================================== … … 542 583 } 543 584 585 ##D-#================================================== 586 ##D-function IGCM_sys_CountFileArchive 587 ##D-* Purpose: Count files on Archive filesystem 588 ##D-* Examples: 589 ##D- 590 #function IGCM_sys_CountFileArchive { 591 # IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 592 # #Command depends on targeted file system 593 # DEBUG_sys=false IGCM_sys_IsFileArchived $1 594 # if [ $? = 0 ] ; then 595 # IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" 596 # status=$? 597 # else 598 # ls ${@} 2>/dev/null | wc -l 599 # status=$? 600 # fi 601 # if [ ${status} -gt 0 ] ; then 602 # echo "IGCM_sys_CountFileArchive : erreur." 603 # fi 604 # IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 605 #} 606 544 607 #D-#================================================== 545 608 #D-function IGCM_sys_CountFileArchive … … 549 612 function IGCM_sys_CountFileArchive { 550 613 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 614 typeset status gayaPosition ergonPosition finalPosition gayaCount ergonCount 551 615 #Command depends on targeted file system 552 616 DEBUG_sys=false IGCM_sys_IsFileArchived $1 553 617 if [ $? = 0 ] ; then 554 IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" 555 status=$? 618 status=0 619 gayaPosition=$( mfls ${@} | grep -n "++ Gaya" | awk -F\: {'print $1'} ) 620 (( status=status + $? )) 621 ergonPosition=$( mfls ${@} | grep -n "++ Ergon" | awk -F\: {'print $1'} ) 622 (( status=status + $? )) 623 finalPosition=$( mfls ${@} | wc -l ) 624 (( status=status + $? )) 625 626 (( gayaCount = ergonPosition - gayaPosition - 4 )) 627 (( ergonCount = finalPosition - ergonPosition - 2 )) 628 629 # return number of files found. greater the better 630 [ ${ergonCount} -ge ${gayaCount} ] && echo ${ergonCount} || echo ${gayaCount} 631 632 # "Ergon only" case 633 #IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" 634 #status=$? 556 635 else 557 636 ls ${@} 2>/dev/null | wc -l
Note: See TracChangeset
for help on using the changeset viewer.