Ignore:
Timestamp:
08/03/12 14:55:30 (12 years ago)
Author:
aclsce
Message:
  • Modified bad error handling
  • Removed tmp files which were created and not removed in case of error.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TOOLS/PACK_IPSL/enlarge_my_files.sh

    r1841 r1843  
    200200 
    201201        startTime=$( getDateMilliSeconds ) # gpdebug : time 
     202        resCmd=0 
    202203        cat $set | $ncrcatcmd $ncrcatoptions -O -x -v $varstoexclude -o $outputfile > $logfile 2>&1 # gpdebug : a retablir 
     204        resCmd=$? 
    203205        meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time 
    204206         
     
    206208        # resultCmd=1 
    207209        # if [ $resultCmd -eq 0 ] ; then 
    208         if [ $? -eq 0 ] ; then 
     210        if [ $resCmd -eq 0 ] ; then 
    209211                sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time 
    210212                datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
     
    214216        else 
    215217                # Add --md5_digest 
     218                rm -f $outputfile*ncrcat.tmp 
    216219                startTime=$( getDateMilliSeconds ) # gpdebug : time 
     220                resCmd=0 
    217221                cat $set | $ncrcatcmd $ncrcatoptions -O -x -v $varstoexclude -o $outputfile > $logfile 2>&1 # gpdebug : a retablir 
     222                resCmd=$? 
    218223                meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time 
    219224                # resultCmd=$( gives_0_or_1 ) 
    220225                # resultCmd=1 
    221226                # if [ $resultCmd -eq 0 ] ; then 
    222                 if [ $? -eq 0 ] ; then 
     227                if [ $resCmd -eq 0 ] ; then 
    223228                        sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time 
    224229                        datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
     
    227232                        echo "COMPLETED at try #$nbtries (at 2nd shot on 2)" >> $statusfile 
    228233                else 
     234                        rm -f $outputfile*ncrcat.tmp 
    229235                        datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
    230236                        echo "====> FAILED at try #$nbtries"  
     
    300306#       #----------------------------------- 
    301307        startTime=$( getDateMilliSeconds ) # gpdebug : time 
     308        resCmd=0 
    302309        $tarcmd $taroptions $outputfile --dereference --files-from $set.local > $logfile 2>&1 # gpdebug : a retablir 
     310        resCmd=$? 
    303311        meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time 
    304312         
    305313        # resultCmd=$( gives_0_or_1 ) 
    306314        # if [ $resultCmd -eq 0 ] ; then 
    307         if [ $? -eq 0 ] ; then 
     315        if [ $resCmd -eq 0 ] ; then 
    308316            sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time 
    309317            datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
     
    326334 
    327335for set in $( ls $PATH_SIMU/restart_tar/*list ) ; do 
    328  
    329336        #----------------------------------- 
    330337        echo "#-------------------" 
     
    376383         
    377384        startTime=$( getDateMilliSeconds ) # gpdebug : time 
     385        resCmd=0 
    378386        $tarcmd $taroptions $outputfile --dereference --files-from $set > $logfile 2>&1 # gpdebug : a retablir 
     387        resCmd=$? 
    379388        meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time 
    380389         
    381390        # resultCmd=$( gives_0_or_1 ) 
    382391        # if [ $resultCmd -eq 0 ] ; then 
    383         if [ $? -eq 0 ] ; then 
     392        if [ $resCmd -eq 0 ] ; then 
    384393            sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time 
    385394            datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
     
    450459 
    451460        startTime=$( getDateMilliSeconds ) # gpdebug : time 
     461        resCmd=0 
    452462        $tarcmd $taroptions $outputfile --dereference --files-from $set > $logfile 2>&1 # gpdebug : a retablir 
     463        resCmd=$? 
    453464        meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time 
    454465         
    455466        # resultCmd=$( gives_0_or_1 ) 
    456467        # if [ $resultCmd -eq 0 ] ; then 
    457         if [ $? -eq 0 ] ; then 
     468        if [ $resCmd -eq 0 ] ; then 
    458469            sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time 
    459470            datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
     
    516527            cpoptions="-rf" 
    517528            startTime=$( getDateMilliSeconds ) # gpdebug : time 
     529            resCmd=0 
    518530            $cpcmd $cpoptions $file $diroutputfile > $logfile 2>&1 # gpdebug : a retablir 
     531            resCmd=$? 
    519532            meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : time 
    520533        done 
     
    522535        # resultCmd=$( gives_0_or_1 ) 
    523536        # if [ $resultCmd -eq 0 ] ; then 
    524         if [ $? -eq 0 ] ; then 
     537        if [ $resCmd -eq 0 ] ; then 
    525538            sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time 
    526539            datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
     
    583596            cpoptions="-rf" 
    584597            startTime=$( getDateMilliSeconds ) # gpdebug : time 
     598            resCmd=0 
    585599            $cpcmd $cpoptions $file $diroutputfile > $logfile 2>&1  # gpdebug : a retablir 
     600            resCmd=$? 
    586601            meantime=$( getTimeDiffSeconds $startTime ) # gpdebug : timeS 
    587602        done 
     
    589604        # resultCmd=$( gives_0_or_1 ) 
    590605        # if [ $resultCmd -eq 0 ] ; then 
    591         if [ $? -eq 0 ] ; then 
     606        if [ $resCmd -eq 0 ] ; then 
    592607            sed -i "1i\meantime:${meantime}" $statusfile # gpdebug : time 
    593608            datestr2=`LC_ALL=C date +"%Y-%m-%dT%H:%M:%S"` 
Note: See TracChangeset for help on using the changeset viewer.