Changeset 1148 for trunk/libIGCM/libIGCM_sys
- Timestamp:
- 01/08/15 16:20:34 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_ada.ksh
r1147 r1148 567 567 #D-* Examples: 568 568 #D- 569 function IGCM_sys_TestFileArchive { 570 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 571 typeset ExistFlag TempCommandFile 572 TempCommandFile="[ -f $1 ] && echo 0 || echo 1" 573 #Command depends on targeted file system 574 #We want it quiet 575 DEBUG_sys=false IGCM_sys_IsFileArchived $1 576 if [ $? = 0 ] ; then 577 ExistFlag=$( IGCM_sys_RshArchive ${TempCommandFile} ) 578 else 579 ExistFlag=$( ${TempCommandFile} ) 580 fi 581 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 582 583 return ${ExistFlag} 584 } 585 586 #D-#================================================== 587 #D-function IGCM_sys_TestFileArchive 588 #D-* Purpose: Test file that must NOT EXISTS on Archive 589 #D-* Examples: 590 #D- 569 591 #function IGCM_sys_TestFileArchive { 570 592 # IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 571 # typeset ExistFlag TempCommandFile 572 # TempCommandFile="[ -f $1 ] && echo 0 || echo 1" 573 # #Command depends on targeted file system 574 # #We want it quiet 593 # typeset ExistFlag finalPosition 594 # 575 595 # DEBUG_sys=false IGCM_sys_IsFileArchived $1 576 596 # if [ $? = 0 ] ; then 577 # ExistFlag=$( IGCM_sys_RshArchive ${TempCommandFile} ) 597 # finalPosition=$( mfls $1 2>/dev/null | wc -l ) 598 # [ ${finalPosition} -eq 4 ] && ExistFlag=1 || ExistFlag=0 578 599 # else 579 # ExistFlag=$( ${TempCommandFile})600 # ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 580 601 # fi 602 # 581 603 # IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 582 604 # 583 605 # return ${ExistFlag} 584 606 #} 585 586 #D-#==================================================587 #D-function IGCM_sys_TestFileArchive588 #D-* Purpose: Test file that must NOT EXISTS on Archive589 #D-* Examples:590 #D-591 function IGCM_sys_TestFileArchive {592 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@593 typeset ExistFlag finalPosition594 595 DEBUG_sys=false IGCM_sys_IsFileArchived $1596 if [ $? = 0 ] ; then597 finalPosition=$( mfls $1 2>/dev/null | wc -l )598 [ ${finalPosition} -eq 4 ] && ExistFlag=1 || ExistFlag=0599 else600 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )601 fi602 603 IGCM_debug_PopStack "IGCM_sys_TestFileArchive"604 605 return ${ExistFlag}606 }607 607 608 608 #D-#================================================== … … 625 625 ##D-* Examples: 626 626 ##D- 627 function IGCM_sys_CountFileArchive { 628 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 629 #Command depends on targeted file system 630 DEBUG_sys=false IGCM_sys_IsFileArchived $1 631 if [ $? = 0 ] ; then 632 IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" 633 status=$? 634 else 635 ls ${@} 2>/dev/null | wc -l 636 status=$? 637 fi 638 if [ ${status} -gt 0 ] ; then 639 echo "IGCM_sys_CountFileArchive : erreur." 640 fi 641 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 642 } 643 644 #D-#================================================== 645 #D-function IGCM_sys_CountFileArchive 646 #D-* Purpose: Count files on Archive filesystem 647 #D-* Examples: 648 #D- 627 649 #function IGCM_sys_CountFileArchive { 628 650 # IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 651 # typeset status gayaPosition ergonPosition finalPosition gayaCount ergonCount 629 652 # #Command depends on targeted file system 630 653 # DEBUG_sys=false IGCM_sys_IsFileArchived $1 631 654 # if [ $? = 0 ] ; then 632 # IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" 633 # status=$? 655 # status=0 656 # gayaPosition=$( mfls ${@} 2>/dev/null | grep -n "++ Gaya" | awk -F\: {'print $1'} ) 657 # (( status=status + $? )) 658 # ergonPosition=$( mfls ${@} 2>/dev/null | grep -n "++ Ergon" | awk -F\: {'print $1'} ) 659 # (( status=status + $? )) 660 # finalPosition=$( mfls ${@} 2>/dev/null | wc -l ) 661 # (( status=status + $? )) 662 663 # (( gayaCount = ergonPosition - gayaPosition - 2 )) 664 # (( ergonCount = finalPosition - ergonPosition )) 665 666 # # return number of files found. greater the better 667 # [ ${ergonCount} -ge ${gayaCount} ] && echo ${ergonCount} || echo ${gayaCount} 668 669 # # "Ergon only" case 670 # #IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" 671 # #status=$? 634 672 # else 635 673 # ls ${@} 2>/dev/null | wc -l … … 641 679 # IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 642 680 #} 643 644 #D-#==================================================645 #D-function IGCM_sys_CountFileArchive646 #D-* Purpose: Count files on Archive filesystem647 #D-* Examples:648 #D-649 function IGCM_sys_CountFileArchive {650 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@651 typeset status gayaPosition ergonPosition finalPosition gayaCount ergonCount652 #Command depends on targeted file system653 DEBUG_sys=false IGCM_sys_IsFileArchived $1654 if [ $? = 0 ] ; then655 status=0656 gayaPosition=$( mfls ${@} 2>/dev/null | grep -n "++ Gaya" | awk -F\: {'print $1'} )657 (( status=status + $? ))658 ergonPosition=$( mfls ${@} 2>/dev/null | grep -n "++ Ergon" | awk -F\: {'print $1'} )659 (( status=status + $? ))660 finalPosition=$( mfls ${@} 2>/dev/null | wc -l )661 (( status=status + $? ))662 663 (( gayaCount = ergonPosition - gayaPosition - 2 ))664 (( ergonCount = finalPosition - ergonPosition ))665 666 # return number of files found. greater the better667 [ ${ergonCount} -ge ${gayaCount} ] && echo ${ergonCount} || echo ${gayaCount}668 669 # "Ergon only" case670 #IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l"671 #status=$?672 else673 ls ${@} 2>/dev/null | wc -l674 status=$?675 fi676 if [ ${status} -gt 0 ] ; then677 echo "IGCM_sys_CountFileArchive : erreur."678 fi679 IGCM_debug_PopStack "IGCM_sys_CountFileArchive"680 }681 681 682 682 #D-#==================================================
Note: See TracChangeset
for help on using the changeset viewer.