Changeset 717


Ignore:
Timestamp:
10/12/12 15:00:41 (12 years ago)
Author:
sdipsl
Message:
  • all available machine but IDRIS (will change soon) : print error code from mv, cp, ...
Location:
trunk/libIGCM/libIGCM_sys
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_default.ksh

    r714 r717  
    522522    IGCM_debug_Exit "IGCM_sys_Tar" 
    523523  fi 
    524  
    525524  IGCM_debug_PopStack "IGCM_sys_Tar" 
    526525} 
     
    711710  fi 
    712711 
    713   typeset RET 
    714  
    715   echo cp --preserve=timestamps $@ > out_rsync 2>&1 
    716   \cp --preserve=timestamps $@ >> out_rsync 2>&1 
    717   RET=$? 
    718  
    719   if [ ${RET} -gt 0 ] ; then 
    720     echo "" 
    721 #       echo "IGCM_sys_Cp : error." 
    722 #       cat out_rsync 
    723 #       IGCM_debug_Exit "IGCM_sys_Cp" 
     712  typeset status 
     713 
     714  echo cp $@ > out_rsync 2>&1 
     715  \cp $@ >> out_rsync 2>&1 
     716  status=$? 
     717 
     718  if [ ${status} -gt 0 ] ; then 
     719    echo "IGCM_sys_Cp : error code ${status}" 
     720    cat out_rsync 
     721    IGCM_debug_Exit "IGCM_sys_Cp" 
    724722  else 
    725723    \rm out_rsync 
     
    739737  fi 
    740738 
    741   typeset RET 
     739  typeset status 
    742740 
    743741  echo rm $@ > out_rsync 2>&1 
    744742  \rm $@ >> out_rsync 2>&1 
    745   RET=$? 
    746  
    747   if [ ${RET} -gt 0 ] ; then 
    748     echo "IGCM_sys_Rm : error." 
     743  status=$? 
     744 
     745  if [ ${status} -gt 0 ] ; then 
     746    echo "IGCM_sys_Rm : error code ${status}" 
    749747    cat out_rsync 
    750748    IGCM_debug_Exit "IGCM_sys_Rm" 
     
    784782  if [ $DRYRUN = 0 ]; then 
    785783 
    786     typeset RET 
     784    typeset status 
    787785 
    788786    echo mv $@ > out_rsync 2>&1 
    789787    \mv $@ >> out_rsync 2>&1 
    790     RET=$? 
    791  
    792     if [ ${RET} -gt 0 ] ; then 
    793       echo "IGCM_sys_Mv : error in mv." 
     788    status=$? 
     789 
     790    if [ ${status} -gt 0 ] ; then 
     791      echo "IGCM_sys_Mv : error code ${status}" 
    794792      cat out_rsync 
    795793      IGCM_debug_Exit "IGCM_sys_Mv" 
     
    821819    fi 
    822820 
    823     typeset RET 
    824  
    825         # Only if we use rsync 
    826         #IGCM_sys_TestDirArchive $( dirname $2 ) 
    827         # 
    828         #USUAL WAY 
    829     \cp -R $1 $2 > out_rsync 2>&1 
    830     RET=$? 
    831  
    832     if [ ${RET} -gt 0 ] ; then 
    833       echo "IGCM_sys_Put_Dir : error." 
     821    typeset status 
     822 
     823    # Only if we use rsync 
     824    #IGCM_sys_TestDirArchive $( dirname $2 ) 
     825    # 
     826    #USUAL WAY 
     827    \cp -r $1 $2 > out_rsync 2>&1 
     828    status=$? 
     829 
     830    if [ ${status} -gt 0 ] ; then 
     831      echo "IGCM_sys_Put_Dir : error code ${status}" 
    834832      cat out_rsync 
    835833      IGCM_debug_Exit "IGCM_sys_Put_Dir" 
     
    845843#D-#================================================== 
    846844#D-function IGCM_sys_Get_Dir 
    847 #D-* Purpose: Copy a complete directory from $(ARCHIVE) 
     845#D-* Purpose: Copy a complete directory from ${ARCHIVE} 
    848846#D-* Examples: 
    849847#D- 
     
    917915#D-#================================================== 
    918916#D-function IGCM_sys_Put_Rest 
    919 #D-* Purpose: Put computied restarts on $(ARCHIVE). 
     917#D-* Purpose: Put computied restarts on ${ARCHIVE}. 
    920918#D-           File and target directory must exist. 
    921919#D-* Examples: 
     
    927925  fi 
    928926  if [ $DRYRUN = 0 ]; then 
    929  
    930     IGCM_sys_TestDirArchive $( dirname $2 ) 
    931  
    932927    if [ ! -f ${1} ] ; then 
    933928      echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 
    934929      IGCM_debug_Exit "IGCM_sys_Put_Rest" 
    935930    fi 
     931 
     932    typeset status 
     933    # 
    936934    if [ X${JobType} = XRUN ] ; then 
    937935      IGCM_sys_Chmod 444 ${1} 
    938936    fi 
    939937 
    940     typeset RET 
    941  
    942     echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 
    943     ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 
    944     RET=$? 
    945     IGCM_sys_Rsync_out $RET 
    946  
    947     ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    948     (( RET=RET+$? )) 
    949  
    950     if [ ${RET} -gt 0 ] ; then 
    951       echo "IGCM_sys_Put_Rest : error." 
     938    # 
     939    # USUAL WAY 
     940    \cp $1 $2 > out_rsync 2>&1 
     941    status=$? 
     942 
     943#       #RSYNC WITH NETWORK SSH CALL 
     944#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     945#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     946 
     947#       #RSYNC WITH NFS USE 
     948#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     949#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     950 
     951#       status=$? 
     952#       IGCM_sys_Rsync_out $status 
     953 
     954#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     955#       (( status=status+$? )) 
     956 
     957    if [ ${status} -gt 0 ] ; then 
     958      echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 
    952959      cat out_rsync 
    953960      IGCM_debug_Exit "IGCM_sys_Put_Rest" 
     
    978985    fi 
    979986 
    980     typeset RET 
     987    typeset status 
    981988    # 
    982989    if [ X${JobType} = XRUN ] ; then 
     
    987994    # USUAL WAY 
    988995    \cp $1 $2 > out_rsync 2>&1 
    989     RET=$? 
    990  
    991     if [ ${RET} -gt 0 ] ; then 
    992       echo "IGCM_sys_PutBuffer_Rest : error." 
     996    status=$? 
     997 
     998    if [ ${status} -gt 0 ] ; then 
     999      echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 
    9931000      cat out_rsync 
    9941001      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     
    10041011#D-#================================================== 
    10051012#D-function IGCM_sys_Put_Out 
    1006 #D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly 
     1013#D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly 
    10071014#D-* Examples: 
    10081015#D- 
     
    11141121  if [ $DRYRUN -le 2 ]; then 
    11151122    if [ X${1} = X'/l' ] ; then 
    1116             # test if the first file is present in the old computation : 
     1123      # test if the first file is present in the old computation : 
    11171124      eval set +A dm_liste \${${2}} 
    11181125    else 
     
    11451152 
    11461153    if [ ${RET} -gt 0 ] ; then 
    1147       echo "IGCM_sys_Get : copy error." 
     1154      echo "IGCM_sys_Get : error" 
    11481155      cat out_rsync 
     1156      \rm out_rsync 
    11491157      IGCM_debug_Exit "IGCM_sys_Get" 
    11501158    else 
     
    11651173  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
    11661174 
    1167   typeset DEST RET buf_liste ifile target file_work 
     1175  typeset DEST RET status buf_liste ifile target file_work 
    11681176 
    11691177  if ( $DEBUG_sys ) ; then 
     
    11891197    else 
    11901198      \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
    1191       RET=$? 
     1199      status=$? 
    11921200    fi 
    11931201 
    11941202    if [ ${RET} -gt 0 ] ; then 
    1195       echo "IGCM_sys_GetBuffer : copy error." 
     1203      echo "IGCM_sys_GetBuffer : error" 
    11961204      cat out_rsync 
     1205      \rm out_rsync 
    11971206      IGCM_debug_Exit "IGCM_sys_GetBuffer" 
    11981207    else 
     
    12421251#D-#================================================== 
    12431252#D-function IGCM_sys_Dods_Rm 
    1244 #D-* Purpose: Suppress files in /tmp/DODS for simulation of internet protocole. 
     1253#D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. 
    12451254#D-* Examples: 
    12461255#D- 
     
    12981307  rebuild -f -o $@ 
    12991308  if [ $? -gt 0 ] ; then 
    1300     echo "IGCM_sys_rebuild : erreur ${@}." 
     1309    echo "IGCM_sys_rebuild : rebuild error" 
    13011310    IGCM_debug_Exit "rebuild" 
    13021311  fi 
     
    17001709# NCO OPERATOR 
    17011710 
    1702  
    17031711function IGCM_sys_ncap2 { 
    17041712  IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh

    r714 r717  
    111111#- IN 
    112112typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM} 
    113 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/dmnfs/cont003/p24data} 
     113typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/ccc/work/cont003/dsm/p24data} 
    114114 
    115115#==================================================== 
     
    674674  fi 
    675675 
    676   typeset RET 
     676  typeset status 
    677677 
    678678  echo cp $@ > out_rsync 2>&1 
    679679  \cp $@ >> out_rsync 2>&1 
    680   RET=$? 
    681  
    682   if [ ${RET} -gt 0 ] ; then 
    683     echo "IGCM_sys_Cp : error." 
     680  status=$? 
     681 
     682  if [ ${status} -gt 0 ] ; then 
     683    echo "IGCM_sys_Cp : error code ${status}" 
    684684    cat out_rsync 
    685685    IGCM_debug_Exit "IGCM_sys_Cp" 
     
    701701  fi 
    702702 
    703   typeset RET 
     703  typeset status 
    704704 
    705705  echo rm $@ > out_rsync 2>&1 
    706706  \rm $@ >> out_rsync 2>&1 
    707   RET=$? 
    708  
    709   if [ ${RET} -gt 0 ] ; then 
    710     echo "IGCM_sys_Rm : error." 
     707  status=$? 
     708 
     709  if [ ${status} -gt 0 ] ; then 
     710    echo "IGCM_sys_Rm : error code ${status}" 
    711711    cat out_rsync 
    712712    IGCM_debug_Exit "IGCM_sys_Rm" 
     
    746746  if [ $DRYRUN = 0 ]; then 
    747747 
    748     typeset RET 
     748    typeset status 
    749749 
    750750    echo mv $@ > out_rsync 2>&1 
    751751    \mv $@ >> out_rsync 2>&1 
    752     RET=$? 
    753  
    754     if [ ${RET} -gt 0 ] ; then 
    755       echo "IGCM_sys_Mv : error in mv." 
     752    status=$? 
     753 
     754    if [ ${status} -gt 0 ] ; then 
     755      echo "IGCM_sys_Mv : error code ${status}" 
    756756      cat out_rsync 
    757757      IGCM_debug_Exit "IGCM_sys_Mv" 
     
    783783    fi 
    784784 
    785     typeset RET 
     785    typeset status 
    786786 
    787787    # Only if we use rsync 
     
    790790    #USUAL WAY 
    791791    \cp -r $1 $2 > out_rsync 2>&1 
    792     RET=$? 
    793  
    794     if [ ${RET} -gt 0 ] ; then 
    795       echo "IGCM_sys_Put_Dir : error." 
     792    status=$? 
     793 
     794    if [ ${status} -gt 0 ] ; then 
     795      echo "IGCM_sys_Put_Dir : error code ${status}" 
    796796      cat out_rsync 
    797797      IGCM_debug_Exit "IGCM_sys_Put_Dir" 
     
    822822#    fi 
    823823 
    824     typeset RET 
     824    typeset NB_ESSAI DELAI status i 
     825    # number of tentative 
     826    NB_ESSAI=3 
     827    # time delay between tentative 
     828    DELAI=2 
    825829 
    826830    # Only if we use rsync 
    827831    #IGCM_sys_TestDirArchive $( dirname $2 ) 
    828832    # 
    829     #USUAL WAY 
    830     # add dmget (to demigrate all offline files) to reduce time of this command : 
    831     #dmget $1/* 
     833    # USUAL WAY 
     834    # add 'ccc_hsm get' (to demigrate all offline files) to reduce time of this command : 
    832835    ccc_hsm get -r $1 
    833     \cp -r $1 $2 > out_rsync 2>&1 
    834     RET=$? 
    835  
    836     if [ ${RET} -gt 0 ] ; then 
     836 
     837    i=0 
     838    while [ $i -lt $NB_ESSAI ] ; do 
     839      \cp -ur $1 $2 >> out_rsync 2>&1 
     840      status=$? 
     841      if [ ${status} -gt 0 ]; then 
     842        IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     843        IGCM_debug_Print 2 "IGCM_sys_Get_Dir : sleep ${DELAI} seconds and try again." 
     844        sleep $DELAI 
     845      else 
     846        break 
     847      fi 
     848      (( i = i + 1 )) 
     849    done 
     850 
     851    if [ ${status} -gt 0 ] ; then 
    837852      echo "IGCM_sys_Get_Dir : error." 
    838853      cat out_rsync 
     
    864879    fi 
    865880 
    866     typeset RET 
    867  
    868     #USUAL WAY 
    869     \cp -rL $1 $2 > out_rsync 2>&1 
    870     RET=$? 
    871  
    872     if [ ${RET} -gt 0 ] ; then 
     881    typeset NB_ESSAI DELAI status i 
     882    # number of tentative 
     883    NB_ESSAI=3 
     884    # time delay between tentative 
     885    DELAI=2 
     886 
     887    i=0 
     888    while [ $i -lt $NB_ESSAI ] ; do 
     889      \cp -urL $1 $2 > out_rsync 2>&1 
     890      status=$? 
     891      if [ ${status} -gt 0 ]; then 
     892        IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     893        IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." 
     894        sleep $DELAI 
     895      else 
     896        break 
     897      fi 
     898      (( i = i + 1 )) 
     899    done 
     900 
     901    if [ ${status} -gt 0 ] ; then 
    873902      echo "IGCM_sys_Get_Master : error." 
    874903      cat out_rsync 
     
    900929    fi 
    901930 
    902     typeset RET 
     931    typeset status 
    903932    # 
    904933    if [ X${JobType} = XRUN ] ; then 
     
    909938    # USUAL WAY 
    910939    \cp $1 $2 > out_rsync 2>&1 
    911     RET=$? 
     940    status=$? 
    912941 
    913942#       #RSYNC WITH NETWORK SSH CALL 
     
    919948#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    920949 
    921 #       RET=$? 
    922 #       IGCM_sys_Rsync_out $RET 
     950#       status=$? 
     951#       IGCM_sys_Rsync_out $status 
    923952 
    924953#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    925 #       (( RET=RET+$? )) 
    926  
    927     if [ ${RET} -gt 0 ] ; then 
    928       echo "IGCM_sys_Put_Rest : error." 
     954#       (( status=status+$? )) 
     955 
     956    if [ ${status} -gt 0 ] ; then 
     957      echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 
    929958      cat out_rsync 
    930959      IGCM_debug_Exit "IGCM_sys_Put_Rest" 
     
    955984    fi 
    956985 
    957     typeset RET 
     986    typeset status 
    958987    # 
    959988    if [ X${JobType} = XRUN ] ; then 
     
    964993    # USUAL WAY 
    965994    \cp $1 $2 > out_rsync 2>&1 
    966     RET=$? 
    967  
    968     if [ ${RET} -gt 0 ] ; then 
    969       echo "IGCM_sys_PutBuffer_Rest : error." 
     995    status=$? 
     996 
     997    if [ ${status} -gt 0 ] ; then 
     998      echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 
    970999      cat out_rsync 
    9711000      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     
    10551084        status=$? 
    10561085        if [ ${status} -gt 0 ]; then 
    1057           IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}" 
     1086          IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 
    10581087          IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 
    10591088          sleep $DELAI 
     
    11531182        status=$? 
    11541183        if [ ${status} -gt 0 ]; then 
    1155           IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed ${i}/${NB_ESSAI}" 
     1184          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 
    11561185          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again." 
    11571186          sleep $DELAI 
     
    12231252 
    12241253    ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 
    1225     RET=$? 
    1226     if [ ${RET} -gt 0 ] ; then 
    1227       echo "WARNING IGCM_sys_Get : demigration error." 
     1254    status=$? 
     1255    if [ ${status} -gt 0 ] ; then 
     1256      echo "WARNING IGCM_sys_Get : error code ${status}" 
    12281257      cat out_rsync 
    12291258      echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 
    12301259    fi 
    12311260 
    1232     #if [ ${RET} -gt 0 ] ; then 
     1261    #if [ ${status} -gt 0 ] ; then 
    12331262    #    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 
    12341263    #   cat out_rsync 
     
    12381267    ##  dmget ${dm_liste[*]} > out_rsync 2>&1 
    12391268    #   ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 
    1240     #   RET=$? 
    1241     #   if [ ${RET} -gt 0 ] ; then 
     1269    #   status=$? 
     1270    #   if [ ${status} -gt 0 ] ; then 
    12421271    #       echo "ERROR IGCM_sys_Get : again demigration error :" 
    12431272    #       cat out_rsync 
     
    12591288        # test if the target file is present before the loop 
    12601289        IGCM_sys_TestFileArchive ${target} 
    1261         RET=$? 
    1262         if [ ${RET} -gt 0 ] ; then 
     1290        status=$? 
     1291        if [ ${status} -gt 0 ] ; then 
    12631292          echo "IGCM_sys_Get, ERROR : regular file ${target} DOES NOT EXIST ." 
    12641293          IGCM_debug_Exit "IGCM_sys_Get" 
     
    12681297            status=$? 
    12691298            if [ ${status} -gt 0 ]; then 
    1270               IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}" 
     1299              IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status} ${i}/${NB_ESSAI}" 
    12711300              IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 
    12721301              sleep $DELAI 
     
    12811310    else 
    12821311      \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 
    1283       RET=$? 
     1312      status=$? 
    12841313    fi 
    12851314 
     
    12921321#       ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    12931322 
    1294 #       RET=$? 
    1295 #       IGCM_sys_Rsync_out $RET 
     1323#       status=$? 
     1324#       IGCM_sys_Rsync_out $status 
    12961325 
    12971326#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     
    12991328 
    13001329    if [ ${RET} -gt 0 ] ; then 
    1301       echo "IGCM_sys_Get : copy error." 
     1330      echo "IGCM_sys_Get : error" 
    13021331      cat out_rsync 
    13031332#      IGCM_debug_Exit "IGCM_sys_Get" 
     
    13191348  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
    13201349 
    1321   typeset DEST RET buf_liste ifile target file_work 
     1350  typeset DEST RET status buf_liste ifile target file_work 
    13221351 
    13231352  if ( $DEBUG_sys ) ; then 
     
    13431372    else 
    13441373      \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
    1345       RET=$? 
     1374      status=$? 
    13461375    fi 
    13471376 
    13481377    if [ ${RET} -gt 0 ] ; then 
    1349       echo "IGCM_sys_GetBuffer : copy error." 
    1350       cat out_rsync 
     1378      echo "IGCM_sys_GetBuffer : error" 
     1379      cat out_rsync 
     1380      \rm out_rsync 
    13511381      IGCM_debug_Exit "IGCM_sys_GetBuffer" 
    13521382    else 
     
    13951425    echo "IGCM_sys_Dods_Rm :" $@ 
    13961426  fi 
    1397   typeset RET 
    1398   RET=0 
     1427  typeset status 
    13991428  if [ $DRYRUN = 0 ]; then 
    14001429 
     
    14061435 
    14071436    /ccc/cont003/home/dsm/p86ipsl/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 
    1408     RET=$? 
    1409  
    1410 #       if [ ${RET} -gt 0 ] ; then 
     1437    status=$? 
     1438 
     1439#       if [ ${status} -gt 0 ] ; then 
    14111440#           echo "IGCM_sys_Dods_Rm : error." 
    14121441#           cat out_dods_rm 
     
    14191448    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    14201449  fi 
    1421   return $RET 
     1450  return $status 
    14221451} 
    14231452 
     
    14311460    echo "IGCM_sys_Dods_Cp :" $@ 
    14321461  fi 
    1433   typeset RET 
    1434   RET=0 
     1462  typeset status 
    14351463  if [ $DRYRUN = 0 ]; then 
    14361464 
     
    14421470 
    14431471    /ccc/cont003/home/dsm/p86ipsl/bin/dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1 
    1444     RET=$? 
    1445  
    1446 #       if [ ${RET} -gt 0 ] ; then 
     1472    status=$? 
     1473 
     1474#       if [ ${status} -gt 0 ] ; then 
    14471475#           echo "IGCM_sys_Dods_Cp : error." 
    14481476#           cat out_dods_cp 
     
    14551483    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    14561484  fi 
    1457   return $RET 
     1485  return $status 
    14581486} 
    14591487 
     
    14681496    echo "IGCM_sys_Put_Dods :" $@ 
    14691497  fi 
    1470   typeset RET 
     1498  #set -vx 
     1499  typeset status 
    14711500  if [ $DRYRUN = 0 ]; then 
    14721501    if ( [ ! -d ${R_SAVE}/${1} ] && [ ! -d ${R_FIGR}/${1} ] ) ; then 
     
    14941523    IGCM_sys_Dods_Rm ${1} 
    14951524    IGCM_sys_Dods_Cp ${1} 
    1496     RET=0 
    1497  
    1498     if [ ${RET} -gt 0 ] ; then 
     1525    status=0 
     1526 
     1527    if [ ${status} -gt 0 ] ; then 
    14991528      echo "IGCM_sys_Put_Dods : error." 
    15001529      IGCM_debug_Exit "IGCM_sys_Put_Dods" 
     
    15141543    echo "IGCM_sys_rebuild :" $@ 
    15151544  fi 
    1516   /home/cont003/p86ipsl/X86_64/bin/rebuild -f -o $@ 
     1545 
     1546  typeset NB_ESSAI DELAI status i 
     1547  # number of tentative 
     1548  NB_ESSAI=3 
     1549  # time delay between tentative 
     1550  DELAI=2 
     1551 
     1552  i=0 
     1553  while [ $i -lt $NB_ESSAI ] ; do 
     1554      /home/cont003/p86ipsl/X86_64/bin/rebuild -f -o $@ > out_rsync 2>&1 
     1555    status=$? 
     1556    if [ ${status} -gt 0 ] ; then 
     1557      IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 
     1558      cat out_rsync 
     1559      \rm out_rsync 
     1560      IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
     1561    else 
     1562      \rm out_rsync 
     1563      break 
     1564    fi 
     1565    (( i = i + 1 )) 
     1566  done 
     1567 
    15171568  if [ $? -gt 0 ] ; then 
    1518     echo "IGCM_sys_rebuild : erreur ${@}." 
     1569    echo "IGCM_sys_rebuild : rebuild error" 
    15191570    IGCM_debug_Exit "rebuild" 
    15201571  fi 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex9.ksh

    r705 r717  
    112112 
    113113#==================================================== 
    114 #- MirrorlibIGCM uncomment for frontend 
     114#- MirrorlibIGCM for frontend 
    115115typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} 
    116116 
    117117#==================================================== 
    118 #- libIGCM_POST uncomment for frontend 
     118#- libIGCM_POST for frontend 
    119119typeset -r libIGCM_POST=${libIGCM} 
    120120 
     
    137137#- IN 
    138138typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM} 
    139 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/dmnfs/cont003/p24data} 
     139typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/ccc/work/cont003/dsm/p24data} 
    140140 
    141141#==================================================== 
     
    245245    IGCM_debug_Exit "IGCM_sys_RshPost" 
    246246  fi 
     247  # delete temporary file 
    247248  \rm tmp_IGCM_sys_RshPost_$$ 
    248249 
     
    291292    status=completed 
    292293  fi 
     294 
    293295  cat  << END_MAIL > job_end.mail 
    294   Dear ${LOGIN}, 
     296Dear ${LOGIN}, 
    295297 
    296298  Simulation ${config_UserChoices_JobName} is ${status} on supercomputer `hostname`. 
     
    354356  fi 
    355357  #- creation de repertoire sur le serveur fichier 
    356   if [ ! -d ${1} ]; then  
     358  if [ ! -d ${1} ]; then 
    357359    \mkdir -p $1 
    358360    if [ $? -gt 0 ] ; then 
     
    375377  fi 
    376378  #- creation de repertoire sur le serveur fichier 
    377   if [ ! -d ${1} ]; then  
     379  if [ ! -d ${1} ]; then 
    378380    \mkdir -p $1 
    379381    if [ $? -gt 0 ] ; then 
     
    664666 
    665667#D-************************* 
    666 #D- File transfer functions  
     668#D- File transfer functions 
    667669#D-************************* 
    668670#D- 
     
    733735  elif [ $MYLANG = "en" ] ; then 
    734736    case $RET in 
    735     0)  return;;                 
     737    0)  return;; 
    736738    1)  echo "rsync error : Syntax or usage error " 
    737739      return;; 
     
    789791  fi 
    790792 
    791   typeset RET DEST 
     793  typeset status DEST 
    792794 
    793795  mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} 
     
    795797  echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 
    796798  ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 
    797   RET=$? 
    798  
    799   if [ ${RET} -gt 0 ] ; then 
     799  status=$? 
     800 
     801  if [ ${status} -gt 0 ] ; then 
    800802    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium." 
    801803    cat out_rsync 
     
    815817  fi 
    816818 
    817   typeset RET 
     819  typeset status 
    818820 
    819821  echo cp $@ > out_rsync 2>&1 
    820822  \cp $@ >> out_rsync 2>&1 
    821   RET=$? 
    822  
    823   if [ ${RET} -gt 0 ] ; then 
    824     echo "IGCM_sys_Cp : error." 
     823  status=$? 
     824 
     825  if [ ${status} -gt 0 ] ; then 
     826    echo "IGCM_sys_Cp : error code ${status}" 
    825827    cat out_rsync 
    826828    IGCM_debug_Exit "IGCM_sys_Cp" 
     
    842844  fi 
    843845 
    844   typeset RET 
     846  typeset status 
    845847 
    846848  echo rm $@ > out_rsync 2>&1 
    847849  \rm $@ >> out_rsync 2>&1 
    848   RET=$? 
    849  
    850   if [ ${RET} -gt 0 ] ; then 
    851     echo "IGCM_sys_Rm : error." 
     850  status=$? 
     851 
     852  if [ ${status} -gt 0 ] ; then 
     853    echo "IGCM_sys_Rm : error code ${status}" 
    852854    cat out_rsync 
    853855    IGCM_debug_Exit "IGCM_sys_Rm" 
     
    871873  if [ $DRYRUN = 0 ]; then 
    872874 
    873     typeset RET 
    874      
     875    typeset status 
     876 
    875877    echo mv $@ > out_rsync 2>&1 
    876878    \mv $@ >> out_rsync 2>&1 
    877     RET=$? 
    878      
    879     if [ ${RET} -gt 0 ] ; then 
    880       echo "IGCM_sys_Mv : error in mv." 
     879    status=$? 
     880 
     881    if [ ${status} -gt 0 ] ; then 
     882      echo "IGCM_sys_Mv : error code ${status}" 
    881883      cat out_rsync 
    882884      IGCM_debug_Exit "IGCM_sys_Mv" 
     
    908910    fi 
    909911 
    910     typeset RET 
     912    typeset status 
    911913 
    912914    # Only if we use rsync 
     
    915917    #USUAL WAY 
    916918    \cp -r $1 $2 > out_rsync 2>&1 
    917     RET=$? 
    918  
    919     if [ ${RET} -gt 0 ] ; then 
    920       echo "IGCM_sys_Put_Dir : error." 
     919    status=$? 
     920 
     921    if [ ${status} -gt 0 ] ; then 
     922      echo "IGCM_sys_Put_Dir : error code ${status}" 
    921923      cat out_rsync 
    922924      IGCM_debug_Exit "IGCM_sys_Put_Dir" 
     
    947949#    fi 
    948950 
    949     typeset RET 
     951    typeset NB_ESSAI DELAI status i 
     952    # number of tentative 
     953    NB_ESSAI=3 
     954    # time delay between tentative 
     955    DELAI=2 
    950956 
    951957    # Only if we use rsync 
     
    953959    # 
    954960    # USUAL WAY 
    955     # add dmfind/dmget (to demigrate all offline files) : 
    956     #dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget 
    957     \cp -r $1 $2 > out_rsync 2>&1 
    958     RET=$? 
    959  
    960     if [ ${RET} -gt 0 ] ; then 
     961    # add 'ccc_hsm get' (to demigrate all offline files) to reduce time of this command : 
     962    ccc_hsm get -r $1 
     963 
     964    i=0 
     965    while [ $i -lt $NB_ESSAI ] ; do 
     966      \cp -ur $1 $2 >> out_rsync 2>&1 
     967      status=$? 
     968      if [ ${status} -gt 0 ]; then 
     969        IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     970        IGCM_debug_Print 2 "IGCM_sys_Get_Dir : sleep ${DELAI} seconds and try again." 
     971        sleep $DELAI 
     972      else 
     973        break 
     974      fi 
     975      (( i = i + 1 )) 
     976    done 
     977 
     978    if [ ${status} -gt 0 ] ; then 
    961979      echo "IGCM_sys_Get_Dir : error." 
    962980      cat out_rsync 
     
    9941012    fi 
    9951013 
    996     typeset RET 
     1014    typeset status 
    9971015    # 
    9981016    if [ X${JobType} = XRUN ] ; then 
     
    10031021    # USUAL WAY 
    10041022    \cp $1 $2 > out_rsync 2>&1 
    1005     RET=$? 
    1006  
    1007 #       #RSYNC WITH NETWORK SSH CALL 
    1008 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
    1009 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
    1010  
    1011      #RSYNC WITH NFS USE 
    1012      echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
    1013      ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    1014  
    1015      RET=$? 
    1016      IGCM_sys_Rsync_out $RET 
    1017  
    1018      ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1019      (( RET=RET+$? )) 
    1020  
    1021     if [ ${RET} -gt 0 ] ; then 
    1022       echo "IGCM_sys_Put_Rest : error." 
     1023    status=$? 
     1024 
     1025#       #RSYNC WITH NETWORK SSH CALL 
     1026#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     1027#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     1028 
     1029     #RSYNC WITH NFS USE 
     1030     echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     1031     ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     1032 
     1033     status=$? 
     1034     IGCM_sys_Rsync_out $status 
     1035 
     1036     ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1037     (( status=status+$? )) 
     1038 
     1039    if [ ${status} -gt 0 ] ; then 
     1040      echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 
    10231041      cat out_rsync 
    10241042      IGCM_debug_Exit "IGCM_sys_Put_Rest" 
     
    10491067    fi 
    10501068 
    1051     typeset RET 
     1069    typeset status 
    10521070    # 
    10531071    if [ X${JobType} = XRUN ] ; then 
     
    10581076    # USUAL WAY 
    10591077    \cp $1 $2 > out_rsync 2>&1 
    1060     RET=$? 
    1061  
    1062     if [ ${RET} -gt 0 ] ; then 
    1063       echo "IGCM_sys_PutBuffer_Rest : error." 
     1078    status=$? 
     1079 
     1080    if [ ${status} -gt 0 ] ; then 
     1081      echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 
    10641082      cat out_rsync 
    10651083      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     
    10831101    echo "IGCM_sys_Put_Out :" $@ 
    10841102  fi 
     1103 
     1104  typeset NB_ESSAI DELAI status i exist skip 
     1105 
     1106  # number of tentative 
     1107  NB_ESSAI=3 
     1108  # time delay between tentative 
     1109  DELAI=2 
     1110 
    10851111  if [ $DRYRUN = 0 ]; then 
    10861112    if [ ! -f ${1} ] ; then 
     
    10921118    IGCM_sys_MkdirArchive $( dirname $2 ) 
    10931119    # 
    1094     typeset RET 
    10951120 
    10961121    #===================================================== 
     
    11021127    #    typeset WORKPATH FILEPATH 
    11031128    #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 
    1104     #    IGCM_sys_MkdirWork ${WORKPATH}  
     1129    #    IGCM_sys_MkdirWork ${WORKPATH} 
    11051130    #    FILEPATH=${WORKPATH}/$( basename $2 ) 
    11061131    #    # 
     
    11101135    if [ X${JobType} = XRUN ] ; then 
    11111136      if [ X${3} = X ] ; then 
    1112         IGCM_sys_Chmod 444 ${1} 
     1137        IGCM_sys_Chmod 444 ${1} 
    11131138      fi 
    11141139    fi 
    11151140    # 
    1116     # USUAL WAY 
    1117     \cp $1 $2 > out_rsync 2>&1 
    1118     RET=$? 
    1119  
    1120 #       #RSYNC WITH NETWORK SSH CALL 
    1121 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
    1122 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
    1123  
    1124 #       #RSYNC WITH NFS USE 
    1125 #       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
    1126 #       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    1127  
    1128 #       RET=$? 
    1129 #       IGCM_sys_Rsync_out $RET 
    1130  
    1131 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1132 #       (( RET=RET+$? )) 
    1133  
    1134     if [ ${RET} -gt 0 ] ; then 
     1141 
     1142    exist=false 
     1143    skip=false 
     1144    if [ -f $2 ] ; then 
     1145      IGCM_debug_Print 1 "$2 already exist" 
     1146      #dmget $2 
     1147      ccc_hsm get $2 
     1148      exist=true 
     1149      if [ "X$( diff $1 $2 )" = X ] ; then 
     1150        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 
     1151        skip=true 
     1152      else 
     1153        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 
     1154        skip=false 
     1155      fi 
     1156    fi 
     1157    # 
     1158    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 
     1159      IGCM_sys_Chmod u+w $2 
     1160    fi 
     1161 
     1162    if [ X${skip} = Xfalse ] ; then 
     1163      (( i = 0 )) 
     1164      while [ $i -lt $NB_ESSAI ] ; do 
     1165        # USUAL WAY 
     1166        \cp $1 $2 > out_rsync 2>&1 
     1167        status=$? 
     1168        if [ ${status} -gt 0 ]; then 
     1169          IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1170          IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 
     1171          sleep $DELAI 
     1172        else 
     1173          break 
     1174        fi 
     1175        (( i = i + 1 )) 
     1176      done 
     1177    fi 
     1178 
     1179#       #RSYNC WITH NETWORK SSH CALL 
     1180#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     1181#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     1182 
     1183#       #RSYNC WITH NFS USE 
     1184#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     1185#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     1186 
     1187#       status=$? 
     1188#       IGCM_sys_Rsync_out $status 
     1189 
     1190#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1191#       (( status=status+$? )) 
     1192 
     1193    if [ ${status} -gt 0 ] ; then 
    11351194      echo "IGCM_sys_Put_Out : error." 
    11361195      cat out_rsync 
     
    11561215    echo "IGCM_sys_PutBuffer_Out :" $@ 
    11571216  fi 
     1217 
     1218  typeset NB_ESSAI DELAI status i exist skip  
     1219 
     1220  # number of tentative 
     1221  NB_ESSAI=3 
     1222  # time delay between tentative 
     1223  DELAI=2 
     1224 
    11581225  if [ $DRYRUN = 0 ]; then 
    11591226    if [ ! -f ${1} ] ; then 
     
    11651232    IGCM_sys_Mkdir $( dirname $2 ) 
    11661233    # 
    1167     typeset RET 
    11681234 
    11691235    if [ X${JobType} = XRUN ] ; then 
    11701236      if [ X${3} = X ] ; then 
    1171         IGCM_sys_Chmod 444 ${1} 
     1237        IGCM_sys_Chmod 444 ${1} 
    11721238      fi 
    11731239    fi 
     1240 
     1241    exist=false 
     1242    skip=false 
     1243    if [ -f $2 ] ; then 
     1244      IGCM_debug_Print 1 "$2 already exist" 
     1245      exist=true 
     1246      if [ "X$( diff $1 $2 )" = X ] ; then 
     1247        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 
     1248        skip=true 
     1249      else 
     1250        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 
     1251        skip=false 
     1252      fi 
     1253    fi 
    11741254    # 
    1175     # USUAL WAY 
    1176     \cp $1 $2 > out_rsync 2>&1 
    1177     RET=$? 
    1178  
    1179     if [ ${RET} -gt 0 ] ; then 
     1255    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 
     1256      IGCM_sys_Chmod u+w $2 
     1257    fi 
     1258 
     1259    if [ X${skip} = Xfalse ] ; then 
     1260      i=0 
     1261      while [ $i -lt $NB_ESSAI ] ; do 
     1262        # USUAL WAY 
     1263        \cp $1 $2 > out_rsync 2>&1 
     1264        status=$? 
     1265        if [ ${status} -gt 0 ]; then 
     1266          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1267          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again." 
     1268          sleep $DELAI 
     1269        else 
     1270          break 
     1271        fi 
     1272        (( i = i + 1 )) 
     1273      done 
     1274    fi 
     1275 
     1276    if [ ${status} -gt 0 ] ; then 
    11801277      echo "IGCM_sys_PutBuffer_Out : error." 
    11811278      cat out_rsync 
     
    11991296  IGCM_debug_PushStack "IGCM_sys_Get" $@ 
    12001297 
    1201   typeset DEST RET dm_liste ifile target file_work  
     1298  typeset DEST RET dm_liste ifile target file_work 
     1299  typeset NB_ESSAI DELAI status i 
    12021300 
    12031301  if ( $DEBUG_sys ) ; then 
    12041302    echo "IGCM_sys_Get :" $@ 
    12051303  fi 
     1304 
     1305  # number of tentative 
     1306  NB_ESSAI=3 
     1307  # time delay between tentative 
     1308  DELAI=2 
     1309 
    12061310  if [ $DRYRUN -le 2 ]; then 
    12071311    if [ X${1} = X'/l' ] ; then 
     
    12291333    #fi 
    12301334 
    1231     # test if the (first) file is present in the old computation : 
    1232     IGCM_sys_TestFileArchive ${dm_liste[0]} 
    1233     RET=$? 
    1234     if [ ${RET} -gt 0 ] ; then 
    1235       echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 
    1236       IGCM_debug_Exit "IGCM_sys_Get" 
    1237     fi 
    1238  
    1239     #dmget ${dm_liste[*]} > out_rsync 2>&1 
    12401335    ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 
    1241     RET=$? 
    1242     if [ ${RET} -gt 0 ] ; then 
    1243       echo "WARNING IGCM_sys_Get : demigration error." 
     1336    status=$? 
     1337    if [ ${status} -gt 0 ] ; then 
     1338      echo "WARNING IGCM_sys_Get : error code ${status}" 
    12441339      cat out_rsync 
    12451340      echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 
    12461341    fi 
    12471342 
    1248     #if [ ${RET} -gt 0 ] ; then 
     1343    #if [ ${status} -gt 0 ] ; then 
    12491344    #    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 
    12501345    #   cat out_rsync 
     
    12541349    ##  dmget ${dm_liste[*]} > out_rsync 2>&1 
    12551350    #   ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 
    1256     #   RET=$? 
    1257     #   if [ ${RET} -gt 0 ] ; then 
    1258     #       echo "ERROR IGCM_sys_Get : again demigration error :" 
    1259     #       cat out_rsync 
    1260     #       IGCM_debug_Exit "IGCM_sys_Get" 
     1351    #   status=$? 
     1352    #   if [ ${status} -gt 0 ] ; then 
     1353    #       echo "ERROR IGCM_sys_Get : again demigration error :" 
     1354    #       cat out_rsync 
     1355    #       IGCM_debug_Exit "IGCM_sys_Get" 
    12611356    #   fi 
    12621357    #    else 
     
    12711366      (( RET=0 )) 
    12721367      for target in ${dm_liste[*]} ; do 
    1273         local_file=$( basename ${target} ) 
    1274         \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1275         (( RET = RET + $? )) 
     1368        local_file=$( basename ${target} ) 
     1369        (( i = 0 )) 
     1370        # test if the target file is present before the loop 
     1371        IGCM_sys_TestFileArchive ${target} 
     1372        status=$? 
     1373        if [ ${status} -gt 0 ] ; then 
     1374          echo "IGCM_sys_Get, ERROR : regular file ${target} DOES NOT EXIST ." 
     1375          IGCM_debug_Exit "IGCM_sys_Get" 
     1376        else 
     1377          while [ $i -lt $NB_ESSAI ] ; do 
     1378            \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1379            status=$? 
     1380            if [ ${status} -gt 0 ]; then 
     1381              IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1382              IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 
     1383              sleep $DELAI 
     1384            else 
     1385              break 
     1386            fi 
     1387            (( i = i + 1 )) 
     1388          done 
     1389          (( RET = RET + status )) 
     1390        fi 
    12761391      done 
    12771392    else 
    12781393      \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 
    1279       RET=$? 
    1280     fi 
    1281  
    1282 #       #RSYNC WITH NETWORK SSH CALL 
    1283 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
    1284 #       ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    1285  
    1286      #RSYNC WITH NFS USE 
    1287      echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 
    1288      ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    1289  
    1290 #       RET=$? 
    1291      IGCM_sys_Rsync_out $RET 
    1292  
    1293      ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1294      (( RET=RET+$? )) 
     1394      status=$? 
     1395    fi 
     1396 
     1397#       #RSYNC WITH NETWORK SSH CALL 
     1398#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
     1399#       ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
     1400 
     1401     #RSYNC WITH NFS USE 
     1402     echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 
     1403     ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
     1404 
     1405#       status=$? 
     1406     IGCM_sys_Rsync_out $status 
     1407 
     1408     ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1409     (( RET=RET+$? )) 
    12951410 
    12961411    if [ ${RET} -gt 0 ] ; then 
    1297       echo "IGCM_sys_Get : copy error." 
     1412      echo "IGCM_sys_Get : error" 
    12981413      cat out_rsync 
     1414      \rm out_rsync 
    12991415      IGCM_debug_Exit "IGCM_sys_Get" 
    13001416    else 
     
    13151431  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
    13161432 
    1317   typeset DEST RET buf_liste ifile target file_work  
     1433  typeset DEST RET status buf_liste ifile target file_work 
    13181434 
    13191435  if ( $DEBUG_sys ) ; then 
     
    13331449      (( RET=0 )) 
    13341450      for target in ${buf_liste[*]} ; do 
    1335         local_file=$( basename ${target} ) 
    1336         \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1337         (( RET = RET + $? )) 
     1451        local_file=$( basename ${target} ) 
     1452        \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1453        (( RET = RET + $? )) 
    13381454      done 
    13391455    else 
    13401456      \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
    1341       RET=$? 
     1457      status=$? 
    13421458    fi 
    13431459 
    13441460    if [ ${RET} -gt 0 ] ; then 
    1345       echo "IGCM_sys_GetBuffer : copy error." 
     1461      echo "IGCM_sys_GetBuffer : error" 
    13461462      cat out_rsync 
     1463      \rm out_rsync 
    13471464      IGCM_debug_Exit "IGCM_sys_GetBuffer" 
    13481465    else 
     
    13751492#D-#================================================== 
    13761493#D-function IGCM_sys_GetDate_FichArchive 
    1377 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE  
     1494#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
    13781495#D-* Examples: 
    13791496#D- 
     
    13981515    echo "IGCM_sys_rebuild :" $@ 
    13991516  fi 
    1400   /home/cont003/p86ipsl/SX8/bin/rebuild -f -o $@ 
     1517 
     1518  typeset NB_ESSAI DELAI status i 
     1519  # number of tentative 
     1520  NB_ESSAI=3 
     1521  # time delay between tentative 
     1522  DELAI=2 
     1523 
     1524  i=0 
     1525  while [ $i -lt $NB_ESSAI ] ; do 
     1526      /home/cont003/p86ipsl/SX8/bin/rebuild -f -o $@ > out_rsync 2>&1 
     1527    status=$? 
     1528    if [ ${status} -gt 0 ] ; then 
     1529      IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 
     1530      cat out_rsync 
     1531      \rm out_rsync 
     1532      IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
     1533    else 
     1534      \rm out_rsync 
     1535      break 
     1536    fi 
     1537    (( i = i + 1 )) 
     1538  done 
     1539 
    14011540  if [ $? -gt 0 ] ; then 
    1402     echo "IGCM_sys_rebuild : erreur ${@}." 
     1541    echo "IGCM_sys_rebuild : rebuild error" 
    14031542    IGCM_debug_Exit "rebuild" 
    14041543  fi 
     
    15671706############################################################ 
    15681707# Build MPI/OMP scripts 
    1569 function IGCM_sys_build_execution_scripts  
     1708function IGCM_sys_build_execution_scripts 
    15701709{ 
    15711710  IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh

    r714 r717  
    6464# Host and user names 
    6565# $hostname ou hostname 
    66 # $hostname ou hostname 
    6766typeset  HOST=${HOST:=$( hostname )} 
    6867# $username ou whoami 
     
    141140 
    142141#==================================================== 
    143 #- OUT 
     142#- R_OUT 
    144143typeset -r R_OUT=${ARCHIVE}/IGCM_OUT 
    145144 
     
    268267    status=completed 
    269268  fi 
     269 
    270270  cat  << END_MAIL > job_end.mail 
    271271Dear ${LOGIN}, 
     
    308308    fi 
    309309  fi 
    310     # vérification : 
     310  # vérification : 
    311311  if [ ! -d ${1} ] ; then 
    312312    echo "IGCM_sys_Mkdir : erreur." 
     
    326326    echo "IGCM_sys_MkdirArchive :" $@ 
    327327  fi 
    328     #- creation de repertoire sur le serveur fichier 
     328  #- creation de repertoire sur le serveur fichier 
    329329  if [ ! -d ${1} ]; then 
    330330    \mkdir -p $1 
     
    347347    echo "IGCM_sys_MkdirWork :" $@ 
    348348  fi 
    349     #- creation de repertoire sur le serveur fichier 
     349  #- creation de repertoire sur le serveur fichier 
    350350  if [ ! -d ${1} ]; then 
    351351    \mkdir -p $1 
     
    537537    IGCM_debug_Exit "IGCM_sys_Tar" 
    538538  fi 
    539  
    540539  IGCM_debug_PopStack "IGCM_sys_Tar" 
    541540} 
     
    607606#D-  Error values and explanations can depend on your system version. 
    608607function IGCM_sys_Rsync_out { 
    609   RET=$1 
    610   if [ ! $RET ] ; then 
     608  status=$1 
     609  if [ ! $status ] ; then 
    611610    echo "rsync error !" 
    612611  fi 
    613612 
    614613  if [ $MYLANG = "fr" ]; then 
    615     case $RET in 
     614    case $status in 
    616615    0)  return ;; 
    617616    1)  echo "Erreur de rsync ; RERR_SYNTAX : " 
     
    661660      echo "Temps d'attente écoulé dans l'envoi/réception de données" 
    662661      return;; 
    663     *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 
     662    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $status 
    664663      return;; 
    665664    esac 
    666665  elif [ $MYLANG = "en" ] ; then 
    667     case $RET in 
     666    case $status in 
    668667    0)  return;; 
    669668    1)  echo "rsync error : Syntax or usage error " 
     
    702701    30) echo "rsync error : Timeout in data send/receive " 
    703702      return;; 
    704     *)  echo "rsync error : return code of rsync unknown :" $RET 
     703    *)  echo "rsync error : return code of rsync unknown :" $status 
    705704      return;; 
    706705    esac 
     
    722721  fi 
    723722 
    724   typeset RET 
    725  
    726   echo cp --preserve=timestamps $@ > out_rsync 2>&1 
    727   \cp --preserve=timestamps $@ >> out_rsync 2>&1 
    728   RET=$? 
    729  
    730   if [ ${RET} -gt 0 ] ; then 
    731     echo "IGCM_sys_Cp : error." 
     723  typeset status 
     724 
     725  echo cp $@ > out_rsync 2>&1 
     726  \cp $@ >> out_rsync 2>&1 
     727  status=$? 
     728 
     729  if [ ${status} -gt 0 ] ; then 
     730    echo "IGCM_sys_Cp : error code ${status}" 
    732731    cat out_rsync 
    733732    IGCM_debug_Exit "IGCM_sys_Cp" 
    734733  else 
    735     rm out_rsync 
     734    \rm out_rsync 
    736735  fi 
    737736  IGCM_debug_PopStack "IGCM_sys_Cp" 
     
    749748  fi 
    750749 
    751   typeset RET 
     750  typeset status 
    752751 
    753752  echo rm $@ > out_rsync 2>&1 
    754753  \rm $@ >> out_rsync 2>&1 
    755   RET=$? 
    756  
    757   if [ ${RET} -gt 0 ] ; then 
    758     echo "IGCM_sys_Rm : error." 
     754  status=$? 
     755 
     756  if [ ${status} -gt 0 ] ; then 
     757    echo "IGCM_sys_Rm : error code ${status}" 
    759758    cat out_rsync 
    760759    IGCM_debug_Exit "IGCM_sys_Rm" 
    761760  else 
    762     rm out_rsync 
     761    \rm out_rsync 
    763762  fi 
    764763  IGCM_debug_PopStack "IGCM_sys_Rm" 
     
    777776  fi 
    778777 
    779   typeset RET 
     778  typeset status 
    780779 
    781780  echo rm $@ > out_rsync 2>&1 
    782781  \rm $@ >> out_rsync 2>&1 
    783   RET=$? 
    784  
    785   if [ ${RET} -gt 0 ] ; then 
    786     echo "IGCM_sys_RmRunDir : error." 
     782  status=$? 
     783 
     784  if [ ${status} -gt 0 ] ; then 
     785    echo "IGCM_sys_RmRunDir : error code ${status}" 
    787786    cat out_rsync 
    788787    IGCM_debug_Exit "IGCM_sys_RmRunDir" 
    789   fi 
    790  
     788  else 
     789    \rm out_rsync 
     790  fi 
    791791  IGCM_debug_PopStack "IGCM_sys_RmRunDir" 
    792792} 
     
    805805  if [ $DRYRUN = 0 ]; then 
    806806 
    807     typeset RET 
     807    typeset status 
    808808 
    809809    echo mv $@ > out_rsync 2>&1 
    810810    \mv $@ >> out_rsync 2>&1 
    811     RET=$? 
    812  
    813     if [ ${RET} -gt 0 ] ; then 
    814       echo "IGCM_sys_Mv : error in mv." 
     811    status=$? 
     812 
     813    if [ ${status} -gt 0 ] ; then 
     814      echo "IGCM_sys_Mv : error code ${status}" 
    815815      cat out_rsync 
    816816      IGCM_debug_Exit "IGCM_sys_Mv" 
    817817    else 
    818       rm out_rsync 
     818      \rm out_rsync 
    819819    fi 
    820820  else 
     
    842842    fi 
    843843 
    844     typeset RET 
    845  
    846         # Only if we use rsync 
    847         #IGCM_sys_TestDirArchive $( dirname $2 ) 
    848         # 
    849         #USUAL WAY 
    850     \cp -R $1 $2 > out_rsync 2>&1 
    851     RET=$? 
    852  
    853     if [ ${RET} -gt 0 ] ; then 
    854       echo "IGCM_sys_Put_Dir : error." 
     844    typeset status 
     845 
     846    # Only if we use rsync 
     847    #IGCM_sys_TestDirArchive $( dirname $2 ) 
     848    # 
     849    #USUAL WAY 
     850    \cp -r $1 $2 > out_rsync 2>&1 
     851    status=$? 
     852 
     853    if [ ${status} -gt 0 ] ; then 
     854      echo "IGCM_sys_Put_Dir : error code ${status}" 
    855855      cat out_rsync 
    856856      IGCM_debug_Exit "IGCM_sys_Put_Dir" 
    857857    else 
    858       rm out_rsync 
     858      \rm out_rsync 
    859859    fi 
    860860  else 
     
    866866#D-#================================================== 
    867867#D-function IGCM_sys_Get_Dir 
    868 #D-* Purpose: Copy a complete directory from $(ARCHIVE) 
     868#D-* Purpose: Copy a complete directory from ${ARCHIVE} 
    869869#D-* Examples: 
    870870#D- 
     
    881881    fi 
    882882 
    883     typeset RET 
     883    typeset status 
    884884 
    885885        #USUAL WAY 
    886886    \cp -R $1 $2 > out_rsync 2>&1 
    887     RET=$? 
    888  
    889     if [ ${RET} -gt 0 ] ; then 
     887    status=$? 
     888 
     889    if [ ${status} -gt 0 ] ; then 
    890890      echo "IGCM_sys_Get_Dir : error." 
    891891      cat out_rsync 
    892892      IGCM_debug_Exit "IGCM_sys_Get_Dir" 
    893893    else 
    894       rm out_rsync 
     894      \rm out_rsync 
    895895    fi 
    896896  else 
     
    917917    fi 
    918918 
    919     typeset RET 
     919    typeset status 
    920920 
    921921        #USUAL WAY 
    922922    cp -RL $1 $2 > out_rsync 2>&1 
    923     RET=$? 
    924  
    925     if [ ${RET} -gt 0 ] ; then 
     923    status=$? 
     924 
     925    if [ ${status} -gt 0 ] ; then 
    926926      echo "IGCM_sys_Get_Master : error." 
    927927      cat out_rsync 
     
    938938#D-#================================================== 
    939939#D-function IGCM_sys_Put_Rest 
    940 #D-* Purpose: Put computied restarts on $(ARCHIVE). 
     940#D-* Purpose: Put computied restarts on ${ARCHIVE}. 
    941941#D-           File and target directory must exist. 
    942942#D-* Examples: 
     
    948948  fi 
    949949  if [ $DRYRUN = 0 ]; then 
    950  
    951     IGCM_sys_TestDirArchive $( dirname $2 ) 
    952  
    953950    if [ ! -f ${1} ] ; then 
    954951      echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 
    955952      IGCM_debug_Exit "IGCM_sys_Put_Rest" 
    956953    fi 
     954 
     955    typeset status 
     956    # 
    957957    if [ X${JobType} = XRUN ] ; then 
    958958      IGCM_sys_Chmod 444 ${1} 
    959959    fi 
    960960 
    961     typeset RET 
    962  
    963     echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 
    964     ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 
    965     RET=$? 
    966     IGCM_sys_Rsync_out $RET 
    967  
    968     ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    969     (( RET=RET+$? )) 
    970  
    971     if [ ${RET} -gt 0 ] ; then 
    972       echo "IGCM_sys_Put_Rest : error." 
     961    # 
     962    # USUAL WAY 
     963    \cp $1 $2 > out_rsync 2>&1 
     964    status=$? 
     965 
     966#       #RSYNC WITH NETWORK SSH CALL 
     967#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     968#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     969 
     970#       #RSYNC WITH NFS USE 
     971#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     972#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     973 
     974#       status=$? 
     975#       IGCM_sys_Rsync_out $status 
     976 
     977#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     978#       (( status=status+$? )) 
     979 
     980    if [ ${status} -gt 0 ] ; then 
     981      echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 
    973982      cat out_rsync 
    974983      IGCM_debug_Exit "IGCM_sys_Put_Rest" 
    975984    else 
    976       rm out_rsync 
     985      \rm out_rsync 
    977986    fi 
    978987  else 
     
    9991008    fi 
    10001009 
    1001     typeset RET 
     1010    typeset status 
    10021011    # 
    10031012    if [ X${JobType} = XRUN ] ; then 
     
    10081017    # USUAL WAY 
    10091018    \cp $1 $2 > out_rsync 2>&1 
    1010     RET=$? 
    1011  
    1012     if [ ${RET} -gt 0 ] ; then 
    1013       echo "IGCM_sys_PutBuffer_Rest : error." 
     1019    status=$? 
     1020 
     1021    if [ ${status} -gt 0 ] ; then 
     1022      echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 
    10141023      cat out_rsync 
    10151024      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     
    10251034#D-#================================================== 
    10261035#D-function IGCM_sys_Put_Out 
    1027 #D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly 
     1036#D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly 
    10281037#D-* Examples: 
    10291038#D- 
     
    10441053    fi 
    10451054 
    1046     typeset RET 
     1055    typeset status 
    10471056        # 
    10481057    if [ X${JobType} = XRUN ] ; then 
     
    10511060      fi 
    10521061    fi 
    1053         # 
     1062    # 
    10541063 
    10551064    echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 
    10561065    ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 
    1057     RET=$? 
    1058     IGCM_sys_Rsync_out $RET 
     1066    status=$? 
     1067    IGCM_sys_Rsync_out $status 
    10591068 
    10601069    ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1061     (( RET=RET+$? )) 
    1062  
    1063     if [ ${RET} -gt 0 ] ; then 
     1070    (( status=status+$? )) 
     1071 
     1072    if [ ${status} -gt 0 ] ; then 
    10641073      echo "IGCM_sys_Put_Out : error." 
    10651074      cat out_rsync 
    10661075      IGCM_debug_Exit "IGCM_sys_Put_Out" 
    10671076    else 
    1068       rm out_rsync 
     1077      \rm out_rsync 
    10691078    fi 
    10701079  else 
     
    10941103    IGCM_sys_Mkdir $( dirname $2 ) 
    10951104    # 
    1096     typeset RET 
     1105    typeset status 
    10971106 
    10981107    if [ X${JobType} = XRUN ] ; then 
     
    11041113    # USUAL WAY 
    11051114    \cp $1 $2 > out_rsync 2>&1 
    1106     RET=$? 
    1107  
    1108     if [ ${RET} -gt 0 ] ; then 
     1115    status=$? 
     1116 
     1117    if [ ${status} -gt 0 ] ; then 
    11091118      echo "IGCM_sys_PutBuffer_Out : error." 
    11101119      cat out_rsync 
     
    11281137  IGCM_debug_PushStack "IGCM_sys_Get" $@ 
    11291138 
    1130   typeset DEST RET dm_liste ifile target 
     1139  typeset DEST RET status dm_liste ifile target 
    11311140 
    11321141  if ( $DEBUG_sys ) ; then 
     
    11351144  if [ $DRYRUN -le 2 ]; then 
    11361145    if [ X${1} = X'/l' ] ; then 
    1137             # test if the first file is present in the old computation : 
     1146      # test if the first file is present in the old computation : 
    11381147      eval set +A dm_liste \${${2}} 
    11391148    else 
     
    11421151    eval DEST=\${${#}} 
    11431152 
    1144         # test if the (first) file is present in the old computation : 
     1153    # test if the (first) file is present in the old computation : 
    11451154    IGCM_sys_TestFileArchive ${dm_liste[0]} 
    1146     RET=$? 
    1147     if [ ${RET} -gt 0 ] ; then 
     1155    status=$? 
     1156    if [ ${status} -gt 0 ] ; then 
    11481157      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 
    11491158      IGCM_debug_Exit "IGCM_sys_Get" 
     
    11591168#       echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1 
    11601169#       ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1 
    1161 #       RET=$? 
    1162 #       IGCM_sys_Rsync_out $RET 
     1170#       status=$? 
     1171#       IGCM_sys_Rsync_out $status 
    11631172 
    11641173#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     
    11661175 
    11671176    if [ ${RET} -gt 0 ] ; then 
    1168       echo "IGCM_sys_Get : copy error." 
     1177      echo "IGCM_sys_Get : error" 
    11691178      cat out_rsync 
     1179      \rm out_rsync 
    11701180      IGCM_debug_Exit "IGCM_sys_Get" 
    11711181    else 
    1172       rm out_rsync 
     1182      \rm out_rsync 
    11731183    fi 
    11741184  else 
     
    11861196  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
    11871197 
    1188   typeset DEST RET buf_liste ifile target file_work 
     1198  typeset DEST RET status buf_liste ifile target file_work 
    11891199 
    11901200  if ( $DEBUG_sys ) ; then 
     
    12101220    else 
    12111221      \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
    1212       RET=$? 
     1222      status=$? 
    12131223    fi 
    12141224 
    12151225    if [ ${RET} -gt 0 ] ; then 
    1216       echo "IGCM_sys_GetBuffer : copy error." 
     1226      echo "IGCM_sys_GetBuffer : error" 
    12171227      cat out_rsync 
     1228      \rm out_rsync 
    12181229      IGCM_debug_Exit "IGCM_sys_GetBuffer" 
    12191230    else 
     
    12631274#D-#================================================== 
    12641275#D-function IGCM_sys_Dods_Rm 
    1265 #D-* Purpose: Suppress files in /tmp/DODS for simulation of internet protocole. 
     1276#D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. 
    12661277#D-* Examples: 
    12671278#D- 
     
    12761287#D-#================================================== 
    12771288#D-function IGCM_sys_Dods_Cp 
    1278 #D-* Purpose: Copy from $(ARCHIVE) files to /tmp/DODS for simulation of internet protocole. 
     1289#D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole. 
    12791290#D-* Examples: 
    12801291#D- 
     
    12881299#D-#================================================== 
    12891300#D-function IGCM_sys_Put_Dods 
    1290 #D-* Purpose: Put $(ARCHIVE) files on /tmp/DODS for simulation of internet protocole. 
     1301#D-* Purpose: Put $(ARCHIVE) files on DODS internet protocole. 
    12911302#D-* Examples: 
    12921303#D- 
     
    12961307    echo "IGCM_sys_Put_Dods :" $@ 
    12971308  fi 
    1298   if [ $DRYRUN = 0 ]; then 
    1299     RET=0 
    1300  
    1301     if [ ${RET} -gt 0 ] ; then 
    1302       echo "IGCM_sys_Put_Dods : error." 
    1303       IGCM_debug_Exit "IGCM_sys_Put_Dods" 
    1304     fi 
    1305   else 
    1306     ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    1307   fi 
    13081309  IGCM_debug_PopStack "IGCM_sys_Put_Dods" 
    13091310} 
     
    13171318    echo "IGCM_sys_rebuild :" $@ 
    13181319  fi 
     1320 
     1321  typeset status 
     1322 
    13191323  /home/users/igcmg/rebuild/bin/rebuild -f -o $@ 
    1320   if [ $? -gt 0 ] ; then 
    1321     echo "IGCM_sys_rebuild : erreur ${@}." 
     1324  status=$? 
     1325  if [ ${status} -gt 0 ] ; then 
     1326    IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 
    13221327    IGCM_debug_Exit "rebuild" 
    13231328  fi 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh

    r714 r717  
    152152#- IN 
    153153typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM} 
    154 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/dmnfs/cont003/p24data} 
     154typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/ccc/work/cont003/dsm/p24data} 
    155155 
    156156#==================================================== 
     
    853853  fi 
    854854 
    855   typeset RET DEST 
     855  typeset status DEST 
    856856 
    857857  mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} 
     
    859859  echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 
    860860  ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 
    861   RET=$? 
    862  
    863   if [ ${RET} -gt 0 ] ; then 
     861  status=$? 
     862 
     863  if [ ${status} -gt 0 ] ; then 
    864864    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium." 
    865865    cat out_rsync 
     
    879879  fi 
    880880 
    881   typeset RET 
     881  typeset status 
    882882 
    883883  echo cp $@ > out_rsync 2>&1 
    884884  \cp $@ >> out_rsync 2>&1 
    885   RET=$? 
    886  
    887   if [ ${RET} -gt 0 ] ; then 
    888     echo "IGCM_sys_Cp : error." 
     885  status=$? 
     886 
     887  if [ ${status} -gt 0 ] ; then 
     888    echo "IGCM_sys_Cp : error code ${status}" 
    889889    cat out_rsync 
    890890    IGCM_debug_Exit "IGCM_sys_Cp" 
     
    906906  fi 
    907907 
    908   typeset RET 
     908  typeset status 
    909909 
    910910  echo rm $@ > out_rsync 2>&1 
    911911  \rm $@ >> out_rsync 2>&1 
    912   RET=$? 
    913  
    914   if [ ${RET} -gt 0 ] ; then 
    915     echo "IGCM_sys_Rm : error." 
     912  status=$? 
     913 
     914  if [ ${status} -gt 0 ] ; then 
     915    echo "IGCM_sys_Rm : error code ${status}" 
    916916    cat out_rsync 
    917917    IGCM_debug_Exit "IGCM_sys_Rm" 
     
    934934  fi 
    935935 
    936   typeset RET 
     936  typeset status 
    937937 
    938938  echo rm $@ > out_rsync 2>&1 
    939939  \rm $@ >> out_rsync 2>&1 
    940   RET=$? 
    941  
    942   if [ ${RET} -gt 0 ] ; then 
    943     echo "IGCM_sys_RmRunDir : error." 
     940  status=$? 
     941 
     942  if [ ${status} -gt 0 ] ; then 
     943    echo "IGCM_sys_RmRunDir : error code ${status}" 
    944944    cat out_rsync 
    945945    IGCM_debug_Exit "IGCM_sys_RmRunDir" 
     
    963963  if [ $DRYRUN = 0 ]; then 
    964964 
    965     typeset RET 
     965    typeset status 
    966966 
    967967    echo mv $@ > out_rsync 2>&1 
    968968    \mv $@ >> out_rsync 2>&1 
    969     RET=$? 
    970  
    971     if [ ${RET} -gt 0 ] ; then 
    972       echo "IGCM_sys_Mv : error in mv." 
     969    status=$? 
     970 
     971    if [ ${status} -gt 0 ] ; then 
     972      echo "IGCM_sys_Mv : error code ${status}" 
    973973      cat out_rsync 
    974974      IGCM_debug_Exit "IGCM_sys_Mv" 
     
    10001000    fi 
    10011001 
    1002     typeset RET 
     1002    typeset status 
    10031003 
    10041004    # Only if we use rsync 
     
    10071007    #USUAL WAY 
    10081008    \cp -r $1 $2 > out_rsync 2>&1 
    1009     RET=$? 
    1010  
    1011     if [ ${RET} -gt 0 ] ; then 
    1012       echo "IGCM_sys_Put_Dir : error." 
     1009    status=$? 
     1010 
     1011    if [ ${status} -gt 0 ] ; then 
     1012      echo "IGCM_sys_Put_Dir : error code ${status}" 
    10131013      cat out_rsync 
    10141014      IGCM_debug_Exit "IGCM_sys_Put_Dir" 
     
    10391039#    fi 
    10401040 
    1041     typeset RET 
     1041    typeset NB_ESSAI DELAI status i 
     1042    # number of tentative 
     1043    NB_ESSAI=3 
     1044    # time delay between tentative 
     1045    DELAI=2 
    10421046 
    10431047    # Only if we use rsync 
     
    10481052    #dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget 
    10491053    ccc_hsm get -r $1 
    1050     \cp -r $1 $2 > out_rsync 2>&1 
    1051     RET=$? 
    1052  
    1053     if [ ${RET} -gt 0 ] ; then 
     1054 
     1055    i=0 
     1056    while [ $i -lt $NB_ESSAI ] ; do 
     1057      \cp -ur $1 $2 >> out_rsync 2>&1 
     1058      status=$? 
     1059      if [ ${status} -gt 0 ]; then 
     1060        IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1061        IGCM_debug_Print 2 "IGCM_sys_Get_Dir : sleep ${DELAI} seconds and try again." 
     1062        sleep $DELAI 
     1063      else 
     1064        break 
     1065      fi 
     1066      (( i = i + 1 )) 
     1067    done 
     1068 
     1069    if [ ${status} -gt 0 ] ; then 
    10541070      echo "IGCM_sys_Get_Dir : error." 
    10551071      cat out_rsync 
     
    10811097    fi 
    10821098 
    1083     typeset RET 
    1084  
    1085     #USUAL WAY 
    1086     \cp -rL $1 $2 > out_rsync 2>&1 
    1087     RET=$? 
    1088  
    1089     if [ ${RET} -gt 0 ] ; then 
     1099    typeset NB_ESSAI DELAI status i 
     1100    # number of tentative 
     1101    NB_ESSAI=3 
     1102    # time delay between tentative 
     1103    DELAI=2 
     1104 
     1105    i=0 
     1106    while [ $i -lt $NB_ESSAI ] ; do 
     1107      \cp -urL $1 $2 > out_rsync 2>&1 
     1108      status=$? 
     1109      if [ ${status} -gt 0 ]; then 
     1110        IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1111        IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." 
     1112        sleep $DELAI 
     1113      else 
     1114        break 
     1115      fi 
     1116      (( i = i + 1 )) 
     1117    done 
     1118 
     1119    if [ ${status} -gt 0 ] ; then 
    10901120      echo "IGCM_sys_Get_Master : error." 
    10911121      cat out_rsync 
     
    11231153    fi 
    11241154 
    1125     typeset RET 
     1155    typeset status 
    11261156    # 
    11271157    if [ X${JobType} = XRUN ] ; then 
     
    11321162    # USUAL WAY 
    11331163    \cp $1 $2 > out_rsync 2>&1 
    1134     RET=$? 
     1164    status=$? 
    11351165 
    11361166#       #RSYNC WITH NETWORK SSH CALL 
     
    11421172#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    11431173 
    1144 #       RET=$? 
    1145 #       IGCM_sys_Rsync_out $RET 
     1174#       status=$? 
     1175#       IGCM_sys_Rsync_out $status 
    11461176 
    11471177#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1148 #       (( RET=RET+$? )) 
    1149  
    1150     if [ ${RET} -gt 0 ] ; then 
    1151       echo "IGCM_sys_Put_Rest : error." 
     1178#       (( status=status+$? )) 
     1179 
     1180    if [ ${status} -gt 0 ] ; then 
     1181      echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 
    11521182      cat out_rsync 
    11531183      IGCM_debug_Exit "IGCM_sys_Put_Rest" 
     
    11781208    fi 
    11791209 
    1180     typeset RET 
     1210    typeset status 
    11811211    # 
    11821212    if [ X${JobType} = XRUN ] ; then 
     
    11871217    # USUAL WAY 
    11881218    \cp $1 $2 > out_rsync 2>&1 
    1189     RET=$? 
    1190  
    1191     if [ ${RET} -gt 0 ] ; then 
    1192       echo "IGCM_sys_PutBuffer_Rest : error." 
     1219    status=$? 
     1220 
     1221    if [ ${status} -gt 0 ] ; then 
     1222      echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 
    11931223      cat out_rsync 
    11941224      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     
    12131243  fi 
    12141244 
    1215   typeset NB_ESSAI DELAI RET i 
     1245  typeset NB_ESSAI DELAI status i exist skip 
    12161246 
    12171247  # number of tentative 
     
    12511281    # 
    12521282 
    1253     (( i = 0 )) 
    1254     while [ $i -lt $NB_ESSAI ] ; do 
    1255     # USUAL WAY 
    1256       \cp $1 $2 > out_rsync 2>&1 
    1257       RET=$? 
    1258       if [ ${RET} -gt 0 ]; then 
    1259         IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}" 
    1260         IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 
    1261         sleep $DELAI 
     1283    exist=false 
     1284    skip=false 
     1285    if [ -f $2 ] ; then 
     1286      IGCM_debug_Print 1 "$2 already exist" 
     1287      #dmget $2 
     1288      ccc_hsm get $2 
     1289      exist=true 
     1290      if [ "X$( diff $1 $2 )" = X ] ; then 
     1291        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 
     1292        skip=true 
    12621293      else 
    1263         break 
     1294        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 
     1295        skip=false 
    12641296      fi 
    1265       (( i = i + 1 )) 
    1266     done 
     1297    fi 
     1298    # 
     1299    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 
     1300      IGCM_sys_Chmod u+w $2 
     1301    fi 
     1302 
     1303    if [ X${skip} = Xfalse ] ; then 
     1304      (( i = 0 )) 
     1305      while [ $i -lt $NB_ESSAI ] ; do 
     1306        # USUAL WAY 
     1307        \cp $1 $2 > out_rsync 2>&1 
     1308        status=$? 
     1309        if [ ${status} -gt 0 ]; then 
     1310          IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1311          IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 
     1312          sleep $DELAI 
     1313        else 
     1314          break 
     1315        fi 
     1316        (( i = i + 1 )) 
     1317      done 
     1318    fi 
    12671319 
    12681320#       #RSYNC WITH NETWORK SSH CALL 
     
    12741326#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    12751327 
    1276 #       RET=$? 
    1277 #       IGCM_sys_Rsync_out $RET 
     1328#       status=$? 
     1329#       IGCM_sys_Rsync_out $status 
    12781330 
    12791331#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1280 #       (( RET=RET+$? )) 
    1281  
    1282     if [ ${RET} -gt 0 ] ; then 
     1332#       (( status=status+$? )) 
     1333 
     1334    if [ ${status} -gt 0 ] ; then 
    12831335      echo "IGCM_sys_Put_Out : error." 
    12841336      cat out_rsync 
     
    13041356    echo "IGCM_sys_PutBuffer_Out :" $@ 
    13051357  fi 
     1358 
     1359  typeset NB_ESSAI DELAI status i exist skip  
     1360 
     1361  # number of tentative 
     1362  NB_ESSAI=3 
     1363  # time delay between tentative 
     1364  DELAI=2 
     1365 
    13061366  if [ $DRYRUN = 0 ]; then 
    13071367    if [ ! -f ${1} ] ; then 
     
    13131373    IGCM_sys_Mkdir $( dirname $2 ) 
    13141374    # 
    1315     typeset RET 
    13161375 
    13171376    if [ X${JobType} = XRUN ] ; then 
     
    13201379      fi 
    13211380    fi 
     1381 
     1382    exist=false 
     1383    skip=false 
     1384    if [ -f $2 ] ; then 
     1385      IGCM_debug_Print 1 "$2 already exist" 
     1386      exist=true 
     1387      if [ "X$( diff $1 $2 )" = X ] ; then 
     1388        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 
     1389        skip=true 
     1390      else 
     1391        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 
     1392        skip=false 
     1393      fi 
     1394    fi 
    13221395    # 
    1323     # USUAL WAY 
    1324     \cp $1 $2 > out_rsync 2>&1 
    1325     RET=$? 
    1326  
    1327     if [ ${RET} -gt 0 ] ; then 
     1396    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 
     1397      IGCM_sys_Chmod u+w $2 
     1398    fi 
     1399 
     1400    if [ X${skip} = Xfalse ] ; then 
     1401      i=0 
     1402      while [ $i -lt $NB_ESSAI ] ; do 
     1403        # USUAL WAY 
     1404        \cp $1 $2 > out_rsync 2>&1 
     1405        status=$? 
     1406        if [ ${status} -gt 0 ]; then 
     1407          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1408          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again." 
     1409          sleep $DELAI 
     1410        else 
     1411          break 
     1412        fi 
     1413        (( i = i + 1 )) 
     1414      done 
     1415    fi 
     1416 
     1417    if [ ${status} -gt 0 ] ; then 
    13281418      echo "IGCM_sys_PutBuffer_Out : error." 
    13291419      cat out_rsync 
     
    13851475 
    13861476    ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 
    1387     RET=$? 
    1388     if [ ${RET} -gt 0 ] ; then 
    1389       echo "WARNING IGCM_sys_Get : demigration error." 
     1477    status=$? 
     1478    if [ ${status} -gt 0 ] ; then 
     1479      echo "WARNING IGCM_sys_Get : error code ${status}" 
    13901480      cat out_rsync 
    13911481      echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 
    13921482    fi 
    13931483 
    1394     #if [ ${RET} -gt 0 ] ; then 
     1484    #if [ ${status} -gt 0 ] ; then 
    13951485    #    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 
    13961486    #   cat out_rsync 
     
    14001490    ##  dmget ${dm_liste[*]} > out_rsync 2>&1 
    14011491    #   ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 
    1402     #   RET=$? 
    1403     #   if [ ${RET} -gt 0 ] ; then 
     1492    #   status=$? 
     1493    #   if [ ${status} -gt 0 ] ; then 
    14041494    #       echo "ERROR IGCM_sys_Get : again demigration error :" 
    14051495    #       cat out_rsync 
     
    14211511        # test if the target file is present before the loop 
    14221512        IGCM_sys_TestFileArchive ${target} 
    1423         RET=$? 
    1424         if [ ${RET} -gt 0 ] ; then 
     1513        status=$? 
     1514        if [ ${status} -gt 0 ] ; then 
    14251515          echo "IGCM_sys_Get, ERROR : regular file ${target} DOES NOT EXIST ." 
    14261516          IGCM_debug_Exit "IGCM_sys_Get" 
     
    14301520            status=$? 
    14311521            if [ ${status} -gt 0 ]; then 
    1432               IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}" 
    1433               IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 
    1434               sleep $DELAI 
     1522              IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1523              IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 
     1524              sleep $DELAI 
    14351525            else 
    1436               break 
     1526              break 
    14371527            fi 
    14381528            (( i = i + 1 )) 
     
    14431533    else 
    14441534      \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 
    1445       RET=$? 
     1535      status=$? 
    14461536    fi 
    14471537 
     
    14541544#       ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    14551545 
    1456 #       RET=$? 
    1457 #       IGCM_sys_Rsync_out $RET 
     1546#       status=$? 
     1547#       IGCM_sys_Rsync_out $status 
    14581548 
    14591549#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     
    14611551 
    14621552    if [ ${RET} -gt 0 ] ; then 
    1463       echo "IGCM_sys_Get : copy error." 
     1553      echo "IGCM_sys_Get : error" 
    14641554      cat out_rsync 
     1555      \rm out_rsync 
    14651556      IGCM_debug_Exit "IGCM_sys_Get" 
    14661557    else 
     
    14811572  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
    14821573 
    1483   typeset DEST RET buf_liste ifile target file_work 
     1574  typeset DEST RET status buf_liste ifile target file_work 
    14841575 
    14851576  if ( $DEBUG_sys ) ; then 
     
    15051596    else 
    15061597      \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
    1507       RET=$? 
     1598      status=$? 
    15081599    fi 
    15091600 
    15101601    if [ ${RET} -gt 0 ] ; then 
    1511       echo "IGCM_sys_GetBuffer : copy error." 
     1602      echo "IGCM_sys_GetBuffer : error" 
    15121603      cat out_rsync 
     1604      \rm out_rsync 
    15131605      IGCM_debug_Exit "IGCM_sys_GetBuffer" 
    15141606    else 
     
    15651657    echo "IGCM_sys_Dods_Rm :" $@ 
    15661658  fi 
    1567   typeset RET 
    1568   RET=0 
     1659  typeset status 
    15691660  if [ $DRYRUN = 0 ]; then 
    15701661 
     
    15761667 
    15771668    /ccc/cont003/home/dsm/p86ipsl/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 
    1578     RET=$? 
    1579  
    1580 #       if [ ${RET} -gt 0 ] ; then 
     1669    status=$? 
     1670 
     1671#       if [ ${status} -gt 0 ] ; then 
    15811672#           echo "IGCM_sys_Dods_Rm : error." 
    15821673#           cat out_dods_rm 
     
    15891680    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    15901681  fi 
    1591   return $RET 
     1682  return $status 
    15921683} 
    15931684 
     
    16011692    echo "IGCM_sys_Dods_Cp :" $@ 
    16021693  fi 
    1603   typeset RET 
    1604   RET=0 
     1694  typeset status 
    16051695  if [ $DRYRUN = 0 ]; then 
    16061696 
     
    16121702 
    16131703    /ccc/cont003/home/dsm/p86ipsl/bin/dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1 
    1614     RET=$? 
    1615  
    1616 #       if [ ${RET} -gt 0 ] ; then 
     1704    status=$? 
     1705 
     1706#       if [ ${status} -gt 0 ] ; then 
    16171707#           echo "IGCM_sys_Dods_Cp : error." 
    16181708#           cat out_dods_cp 
     
    16251715    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    16261716  fi 
    1627   return $RET 
     1717  return $status 
    16281718} 
    16291719 
     
    16381728    echo "IGCM_sys_Put_Dods :" $@ 
    16391729  fi 
    1640   set -vx 
    1641   typeset RET 
     1730  #set -vx 
     1731  typeset status 
    16421732  if [ $DRYRUN = 0 ]; then 
    16431733    if ( [ ! -d ${R_SAVE}/${1} ] && [ ! -d ${R_FIGR}/${1} ] ) ; then 
     
    16651755    IGCM_sys_Dods_Rm ${1} 
    16661756    IGCM_sys_Dods_Cp ${1} 
    1667     RET=0 
    1668  
    1669     if [ ${RET} -gt 0 ] ; then 
     1757    status=0 
     1758 
     1759    if [ ${status} -gt 0 ] ; then 
    16701760      echo "IGCM_sys_Put_Dods : error." 
    16711761      IGCM_debug_Exit "IGCM_sys_Put_Dods" 
     
    16851775    echo "IGCM_sys_rebuild :" $@ 
    16861776  fi 
    1687   /home/cont003/p86ipsl/X64/bin/rebuild -f -o $@ 
     1777 
     1778  typeset NB_ESSAI DELAI status i 
     1779  # number of tentative 
     1780  NB_ESSAI=3 
     1781  # time delay between tentative 
     1782  DELAI=2 
     1783 
     1784  i=0 
     1785  while [ $i -lt $NB_ESSAI ] ; do 
     1786      /home/cont003/p86ipsl/X64/bin/rebuild -f -o $@ > out_rsync 2>&1 
     1787    status=$? 
     1788    if [ ${status} -gt 0 ] ; then 
     1789      IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 
     1790      cat out_rsync 
     1791      \rm out_rsync 
     1792      IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
     1793    else 
     1794      \rm out_rsync 
     1795      break 
     1796    fi 
     1797    (( i = i + 1 )) 
     1798  done 
     1799 
    16881800  if [ $? -gt 0 ] ; then 
    1689     echo "IGCM_sys_rebuild : erreur ${@}." 
     1801    echo "IGCM_sys_rebuild : rebuild error" 
    16901802    IGCM_debug_Exit "rebuild" 
    16911803  fi 
Note: See TracChangeset for help on using the changeset viewer.