Changeset 676 for trunk


Ignore:
Timestamp:
06/05/12 16:31:28 (12 years ago)
Author:
sdipsl
Message:
  • Prevent the fact that cp command is not reliable on ccrt/tgcc filesystems
  • Cosmetics
Location:
trunk/libIGCM/libIGCM_sys
Files:
4 edited

Legend:

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

    r664 r676  
    1 #!/bin/ksh  
     1#!/bin/ksh 
    22 
    33#************************************************************** 
     
    1414#========================================================= 
    1515# The documentation of this file can be automatically generated 
    16 # if you use the prefix #D- for comments to be extracted.  
     16# if you use the prefix #D- for comments to be extracted. 
    1717# Extract with command: cat lib* | grep "^#D-" | cut -c "4-" 
    1818#========================================================= 
     
    2222#D-#================================================== 
    2323#D- 
    24 #D- This ksh library if a layer under some usefull  
     24#D- This ksh library if a layer under some usefull 
    2525#D-environment variables and shell commands. 
    2626#D-All those definitions depend on host particularities. 
     
    6262 
    6363#===================================================== 
    64 # Host and user names  
     64# Host and user names 
    6565# $hostname ou hostname 
    6666typeset  HOST=${HOST:=$( hostname )} 
     
    104104 
    105105#==================================================== 
    106 # For interactive jobs on cesium  
     106# For interactive jobs on cesium 
    107107PBS_O_WORKDIR=${PBS_O_WORKDIR:=$(pwd)} 
    108108 
     
    117117#- ARCHIVE (dedicated to small/medium files) 
    118118typeset -r STORAGE=${CCCWORKDIR} 
    119  
    120 #==================================================== 
    121119 
    122120#==================================================== 
     
    327325  fi 
    328326  #- creation de repertoire sur le serveur fichier 
    329   if [ ! -d ${1} ]; then  
     327  if [ ! -d ${1} ]; then 
    330328    \mkdir -p $1 
    331329    if [ $? -gt 0 ] ; then 
     
    348346  fi 
    349347  #- creation de repertoire sur le serveur fichier 
    350   if [ ! -d ${1} ]; then  
     348  if [ ! -d ${1} ]; then 
    351349    \mkdir -p $1 
    352350    if [ $? -gt 0 ] ; then 
     
    511509#D-#================================================== 
    512510#D-function IGCM_sys_CountFileBuffer 
    513 #D-* Purpose: Count files on Master Scratch filesystem 
     511#D-* Purpose: Count files on Scratch filesystem 
    514512#D-* Examples: 
    515513#D- 
     
    612610 
    613611#D-************************* 
    614 #D- File transfer functions  
     612#D- File transfer functions 
    615613#D-************************* 
    616614#D- 
     
    681679  elif [ $MYLANG = "en" ] ; then 
    682680    case $RET in 
    683     0)  return;;                 
     681    0)  return;; 
    684682    1)  echo "rsync error : Syntax or usage error " 
    685683      return;; 
     
    822820 
    823821    typeset RET 
    824      
     822 
    825823    echo mv $@ > out_rsync 2>&1 
    826824    \mv $@ >> out_rsync 2>&1 
    827825    RET=$? 
    828      
     826 
    829827    if [ ${RET} -gt 0 ] ; then 
    830828      echo "IGCM_sys_Mv : error in mv." 
     
    934932 
    935933    typeset TEST NB_ESSAI DELAI status i 
    936      
     934 
    937935    TEST=$( IGCM_sys_RshMaster ( [ -d $1 ] || [ -f $1 ] ) && echo 1 || echo 0 ) 
    938936    if [ ${TEST} -ne 1 ] ; then 
     
    949947    (( i = 0 )) 
    950948    while [ $i -lt $NB_ESSAI ] ; do 
    951             #USUAL WAY 
     949            #USUAL WAY 
    952950      scp -r ${MASTER}:$1 $2 > out_rsync 2>&1 
    953951      status=$? 
    954952      if [ ${status} -gt 0 ]; then 
    955         IGCM_debug_Print 2 "IGCM_sys_Get_Master : scp failed ${i}/${NB_ESSAI}" 
    956         IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." 
    957         sleep $DELAI 
     953        IGCM_debug_Print 2 "IGCM_sys_Get_Master : scp failed ${i}/${NB_ESSAI}" 
     954        IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." 
     955        sleep $DELAI 
    958956      else 
    959         break 
     957        break 
    960958      fi 
    961959      (( i = i + 1 )) 
     
    10031001    RET=$? 
    10041002 
    1005 #       #RSYNC WITH NETWORK SSH CALL 
    1006 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
    1007 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
    1008  
    1009      #RSYNC WITH NFS USE 
    1010      echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
    1011      ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    1012  
    1013      RET=$? 
    1014      IGCM_sys_Rsync_out $RET 
    1015  
    1016      ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1017      (( RET=RET+$? )) 
     1003#       #RSYNC WITH NETWORK SSH CALL 
     1004#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     1005#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     1006 
     1007     #RSYNC WITH NFS USE 
     1008     echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     1009     ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     1010 
     1011     RET=$? 
     1012     IGCM_sys_Rsync_out $RET 
     1013 
     1014     ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1015     (( RET=RET+$? )) 
    10181016 
    10191017    if [ ${RET} -gt 0 ] ; then 
     
    10401038    echo "IGCM_sys_Put_Out :" $@ 
    10411039  fi 
     1040 
     1041  typeset NB_ESSAI DELAI RET i exist skip 
     1042 
     1043  # number of tentative 
     1044  NB_ESSAI=3 
     1045  # time delay between tentative 
     1046  DELAI=2 
     1047 
    10421048  if [ $DRYRUN = 0 ]; then 
    10431049    if [ ! -f ${1} ] ; then 
     
    10491055    IGCM_sys_MkdirArchive $( dirname $2 ) 
    10501056    # 
    1051     typeset RET exist skip 
    10521057 
    10531058    #===================================================== 
     
    10591064    #    typeset WORKPATH FILEPATH 
    10601065    #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 
    1061     #    IGCM_sys_MkdirWork ${WORKPATH}  
     1066    #    IGCM_sys_MkdirWork ${WORKPATH} 
    10621067    #    FILEPATH=${WORKPATH}/$( basename $2 ) 
    10631068    #    # 
     
    10671072    if [ X${JobType} = XRUN ] ; then 
    10681073      if [ X${3} = X ] ; then 
    1069         IGCM_sys_Chmod 444 ${1} 
     1074        IGCM_sys_Chmod 444 ${1} 
    10701075      fi 
    10711076    fi 
     1077    # 
    10721078 
    10731079    exist=false 
     
    10791085      exist=true 
    10801086      if [ "X$( diff $1 $2 )" = X ] ; then 
    1081         IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 
    1082         skip=true 
     1087        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 
     1088        skip=true 
    10831089      else 
    1084         IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 
    1085         skip=false 
     1090        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 
     1091        skip=false 
    10861092      fi 
    10871093    fi 
    1088         #  
     1094    # 
    10891095    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 
    10901096      IGCM_sys_Chmod u+w $2 
    10911097    fi 
    1092         # USUAL WAY 
     1098 
    10931099    if [ X${skip} = Xfalse ] ; then 
    1094       cp $1 $2 > out_rsync 2>&1 
    1095       RET=$? 
    1096       if [ ${RET} -gt 0 ] ; then 
    1097         echo "IGCM_sys_Put_Out : error." 
    1098         cat out_rsync 
    1099         IGCM_debug_Exit "IGCM_sys_Put_Out" 
    1100       else 
    1101         \rm out_rsync 
    1102       fi 
    1103     fi 
    1104  
    1105 #       #RSYNC WITH NETWORK RSH CALL 
    1106 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1 
    1107 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1 
    1108  
    1109 #       #RSYNC WITH NFS USE 
    1110 #       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
    1111 #       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    1112  
    1113 #       RET=$? 
    1114 #       IGCM_sys_Rsync_out $RET 
    1115  
    1116 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1117 #       (( RET=RET+$? )) 
    1118  
    1119  
     1100      (( i = 0 )) 
     1101      while [ $i -lt $NB_ESSAI ] ; do 
     1102        # USUAL WAY 
     1103        \cp $1 $2 > out_rsync 2>&1 
     1104        RET=$? 
     1105        if [ ${RET} -gt 0 ]; then 
     1106          IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}" 
     1107          IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 
     1108          sleep $DELAI 
     1109        else 
     1110          break 
     1111        fi 
     1112        (( i = i + 1 )) 
     1113      done 
     1114    fi 
     1115 
     1116#       #RSYNC WITH NETWORK RSH CALL 
     1117#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1 
     1118#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1 
     1119 
     1120#       #RSYNC WITH NFS USE 
     1121#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     1122#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     1123 
     1124#       RET=$? 
     1125#       IGCM_sys_Rsync_out $RET 
     1126 
     1127#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1128#       (( RET=RET+$? )) 
     1129 
     1130    if [ ${RET} -gt 0 ] ; then 
     1131      echo "IGCM_sys_Put_Out : error." 
     1132      cat out_rsync 
     1133      IGCM_debug_Exit "IGCM_sys_Put_Out" 
     1134    else 
     1135      \rm out_rsync 
     1136    fi 
    11201137  else 
    11211138    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     
    11331150  IGCM_debug_PushStack "IGCM_sys_Get" $@ 
    11341151 
    1135   typeset DEST RET dm_liste ifile target file_work  
     1152  typeset DEST RET dm_liste ifile target file_work 
     1153  typeset NB_ESSAI DELAI status i 
    11361154 
    11371155  if ( $DEBUG_sys ) ; then 
    11381156    echo "IGCM_sys_Get :" $@ 
    11391157  fi 
     1158 
     1159  # number of tentative 
     1160  NB_ESSAI=3 
     1161  # time delay between tentative 
     1162  DELAI=2 
     1163 
    11401164  if [ $DRYRUN -le 2 ]; then 
    11411165    if [ X${1} = X'/l' ] ; then 
     
    11631187    #fi 
    11641188 
    1165     # test if the (first) file is present in the old computation : 
    1166     IGCM_sys_TestFileArchive ${dm_liste[0]} 
    1167     RET=$? 
    1168     if [ ${RET} -gt 0 ] ; then 
    1169       echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 
    1170       IGCM_debug_Exit "IGCM_sys_Get" 
    1171     fi 
    1172  
    1173     #dmget ${dm_liste[*]} > out_rsync 2>&1 
    11741189    ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 
    11751190    RET=$? 
     
    11901205    #   RET=$? 
    11911206    #   if [ ${RET} -gt 0 ] ; then 
    1192     #       echo "ERROR IGCM_sys_Get : again demigration error :" 
    1193     #       cat out_rsync 
    1194     #       IGCM_debug_Exit "IGCM_sys_Get" 
     1207    #       echo "ERROR IGCM_sys_Get : again demigration error :" 
     1208    #       cat out_rsync 
     1209    #       IGCM_debug_Exit "IGCM_sys_Get" 
    11951210    #   fi 
    11961211    #    else 
     
    12051220      (( RET=0 )) 
    12061221      for target in ${dm_liste[*]} ; do 
    1207         local_file=$( basename ${target} ) 
    1208         \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1209         (( RET = RET + $? )) 
     1222        local_file=$( basename ${target} ) 
     1223        (( i = 0 )) 
     1224        # test if the target file is present before the loop 
     1225        IGCM_sys_TestFileArchive ${target} 
     1226        RET=$? 
     1227        if [ ${RET} -gt 0 ] ; then 
     1228          echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 
     1229          IGCM_debug_Exit "IGCM_sys_Get" 
     1230        else 
     1231          while [ $i -lt $NB_ESSAI ] ; do 
     1232            \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1233            status=$? 
     1234            if [ ${status} -gt 0 ]; then 
     1235              IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}" 
     1236              IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 
     1237              sleep $DELAI 
     1238            else 
     1239              break 
     1240            fi 
     1241            (( i = i + 1 )) 
     1242          done 
     1243          (( RET = RET + status )) 
     1244        fi 
    12101245      done 
    12111246    else 
     
    12141249    fi 
    12151250 
    1216 #       #RSYNC WITH NETWORK SSH CALL 
    1217 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
    1218 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    1219  
    1220      #RSYNC WITH NFS USE 
    1221      echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 
    1222      ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    1223  
    1224 #       RET=$? 
    1225      IGCM_sys_Rsync_out $RET 
    1226  
    1227      ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1228      (( RET=RET+$? )) 
     1251#       #RSYNC WITH NETWORK SSH CALL 
     1252#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
     1253#       ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
     1254 
     1255     #RSYNC WITH NFS USE 
     1256     echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 
     1257     ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
     1258 
     1259#       RET=$? 
     1260     IGCM_sys_Rsync_out $RET 
     1261 
     1262     ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1263     (( RET=RET+$? )) 
    12291264 
    12301265    if [ ${RET} -gt 0 ] ; then 
     
    12491284  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
    12501285 
    1251   typeset DEST RET buf_liste ifile target file_work  
     1286  typeset DEST RET buf_liste ifile target file_work 
    12521287 
    12531288  if ( $DEBUG_sys ) ; then 
     
    12671302      (( RET=0 )) 
    12681303      for target in ${buf_liste[*]} ; do 
    1269         local_file=$( basename ${target} ) 
    1270         \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1271         (( RET = RET + $? )) 
     1304        local_file=$( basename ${target} ) 
     1305        \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1306        (( RET = RET + $? )) 
    12721307      done 
    12731308    else 
     
    12991334    echo "IGCM_sys_GetDate_FichWork :" $@ 
    13001335  fi 
    1301     # donne la date filesys d'un fichier sur la machine work 
     1336  # donne la date filesys d'un fichier sur la machine work 
    13021337  IGCM_debug_PopStack "IGCM_sys_FichWork" 
    13031338} 
     
    13051340#D-#================================================== 
    13061341#D-function IGCM_sys_GetDate_FichArchive 
    1307 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE  
     1342#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
    13081343#D-* Examples: 
    13091344#D- 
     
    13371372    /ccc/cont003/home/dsm/p86maf/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 
    13381373    RET=$? 
    1339      
     1374 
    13401375#       if [ ${RET} -gt 0 ] ; then 
    1341 #           echo "IGCM_sys_Dods_Rm : error." 
    1342 #           cat out_dods_rm 
    1343 #           IGCM_debug_Exit "IGCM_sys_Dods_Rm" 
     1376#           echo "IGCM_sys_Dods_Rm : error." 
     1377#           cat out_dods_rm 
     1378#           IGCM_debug_Exit "IGCM_sys_Dods_Rm" 
    13441379#       else 
    1345 #           rm out_dods_rm 
     1380#           rm out_dods_rm 
    13461381#       fi 
    13471382 
     
    13631398  typeset RET 
    13641399  RET=0 
    1365  
    13661400  if [ $DRYRUN = 0 ]; then 
    13671401 
     
    13751409    RET=$? 
    13761410 
    1377 #       if [ ${RET} -gt 0 ] ; then 
    1378 #           echo "IGCM_sys_Dods_Cp : error." 
    1379 #           cat out_dods_cp 
    1380 #           IGCM_debug_Exit "IGCM_sys_Dods_Cp" 
    1381 #       else 
    1382 #           rm out_dods_cp 
    1383 #       fi 
     1411#       if [ ${RET} -gt 0 ] ; then 
     1412#           echo "IGCM_sys_Dods_Cp : error." 
     1413#           cat out_dods_cp 
     1414#           IGCM_debug_Exit "IGCM_sys_Dods_Cp" 
     1415#       else 
     1416#           rm out_dods_cp 
     1417#       fi 
    13841418 
    13851419  else 
     
    14011435  typeset RET 
    14021436  if [ $DRYRUN = 0 ]; then 
    1403  
    14041437    if ( [ ! -d ${R_SAVE}/${1} ] && [ ! -d ${R_FIGR}/${1} ] ) ; then 
    14051438      echo "WARNING IGCM_sys_Put_Dods : None of the following directories exist. Exactly one should." 
     
    14271460    IGCM_sys_Dods_Cp ${1} 
    14281461    RET=0 
    1429      
     1462 
    14301463    if [ ${RET} -gt 0 ] ; then 
    14311464      echo "IGCM_sys_Put_Dods : error." 
     
    14941527    IGCM_debug_PushStack "IGCM_sys_check_quota" 
    14951528    if ( $DEBUG_sys ) ; then 
    1496         echo "IGCM_sys_check_quota" 
     1529        echo "IGCM_sys_check_quota" 
    14971530    fi 
    14981531    IGCM_debug_PopStack "IGCM_sys_check_quota" 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh

    r669 r676  
    203203(( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL )) 
    204204DEFAULT_NUM_PROC_TOTAL=${BATCH_NUM_PROC_TOT} 
     205 
    205206 
    206207#D-#================================================== 
     
    10161017    typeset RET 
    10171018 
    1018         # Only if we use rsync 
    1019         #IGCM_sys_TestDirArchive $( dirname $2 ) 
    1020         # 
    1021         #USUAL WAY 
    1022         # add get (to demigrate all offline files) to reduce time of this command : 
     1019    # Only if we use rsync 
     1020    #IGCM_sys_TestDirArchive $( dirname $2 ) 
     1021    # 
     1022    #USUAL WAY 
     1023    # add get (to demigrate all offline files) to reduce time of this command : 
    10231024    ccc_hsm get $1/* 
    10241025    \cp -r $1 $2 > out_rsync 2>&1 
     
    12251226      RET=$? 
    12261227      if [ ${RET} -gt 0 ]; then 
    1227         IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}" 
    1228         IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 
    1229         sleep $DELAI 
     1228        IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}" 
     1229        IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 
     1230        sleep $DELAI 
    12301231      else 
    1231         break 
     1232        break 
    12321233      fi 
    12331234      (( i = i + 1 )) 
     
    13981399            status=$? 
    13991400            if [ ${status} -gt 0 ]; then 
    1400               IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}" 
    1401               IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 
    1402               sleep $DELAI 
     1401              IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}" 
     1402              IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 
     1403              sleep $DELAI 
    14031404            else 
    1404               break 
     1405              break 
    14051406            fi 
    14061407            (( i = i + 1 )) 
     
    20042005    IGCM_debug_PopStack "IGCM_sys_check_quota" 
    20052006} 
    2006  
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh

    r669 r676  
    1 #!/bin/ksh  
     1#!/bin/ksh 
    22 
    33#************************************************************** 
     
    1414#========================================================= 
    1515# The documentation of this file can be automatically generated 
    16 # if you use the prefix #D- for comments to be extracted.  
     16# if you use the prefix #D- for comments to be extracted. 
    1717# Extract with command: cat lib* | grep "^#D-" | cut -c "4-" 
    1818#========================================================= 
     
    2222#D-#================================================== 
    2323#D- 
    24 #D- This ksh library if a layer under some usefull  
     24#D- This ksh library if a layer under some usefull 
    2525#D-environment variables and shell commands. 
    2626#D-All those definitions depend on host particularities. 
     
    9494 
    9595#==================================================== 
    96 # For interactive jobs on mercure  
     96# For interactive jobs on mercure 
    9797PBS_O_WORKDIR=${PBS_O_WORKDIR:=$(pwd)} 
    9898 
     
    220220    status=completed 
    221221  fi 
     222 
    222223  cat  << END_MAIL > job_end.mail 
    223224Dear ${LOGIN}, 
     
    281282  fi 
    282283  #- creation de repertoire sur le serveur fichier 
    283   if [ ! -d ${1} ]; then  
     284  if [ ! -d ${1} ]; then 
    284285    \mkdir -p $1 
    285286    if [ $? -gt 0 ] ; then 
     
    302303  fi 
    303304  #- creation de repertoire sur le serveur fichier 
    304   if [ ! -d ${1} ]; then  
     305  if [ ! -d ${1} ]; then 
    305306    \mkdir -p $1 
    306307    if [ $? -gt 0 ] ; then 
     
    548549 
    549550#D-************************* 
    550 #D- File transfer functions  
     551#D- File transfer functions 
    551552#D-************************* 
    552553#D- 
     
    617618  elif [ $MYLANG = "en" ] ; then 
    618619    case $RET in 
    619     0)  return;;                 
     620    0)  return;; 
    620621    1)  echo "rsync error : Syntax or usage error " 
    621622      return;; 
     
    746747 
    747748    typeset RET 
    748      
     749 
    749750    echo mv $@ > out_rsync 2>&1 
    750751    \mv $@ >> out_rsync 2>&1 
    751752    RET=$? 
    752      
     753 
    753754    if [ ${RET} -gt 0 ] ; then 
    754755      echo "IGCM_sys_Mv : error in mv." 
     
    806807#D-#================================================== 
    807808#D-function IGCM_sys_Get_Dir 
    808 #D-* Purpose: Copy a complete directory from $(ARCHIVE) 
     809#D-* Purpose: Copy a complete directory from ${ARCHIVE} 
    809810#D-* Examples: 
    810811#D- 
     
    815816  fi 
    816817  if [ $DRYRUN = 0 ]; then 
    817 #       if [ ! -d ${1} ] ; then 
    818 #           echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 
    819 #           IGCM_debug_PopStack "IGCM_sys_Get_Dir" 
    820 #           return 
    821 #       fi 
     818#    if [ ! -d ${1} ] ; then 
     819#      echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 
     820#      IGCM_debug_PopStack "IGCM_sys_Get_Dir" 
     821#      return 
     822#    fi 
    822823 
    823824    typeset RET 
     
    910911    RET=$? 
    911912 
    912 #       #RSYNC WITH NETWORK SSH CALL 
    913 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
    914 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
    915  
    916      #RSYNC WITH NFS USE 
    917      echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
    918      ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    919  
    920      RET=$? 
    921      IGCM_sys_Rsync_out $RET 
    922  
    923      ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    924      (( RET=RET+$? )) 
     913#       #RSYNC WITH NETWORK SSH CALL 
     914#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     915#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     916 
     917     #RSYNC WITH NFS USE 
     918     echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     919     ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     920 
     921     RET=$? 
     922     IGCM_sys_Rsync_out $RET 
     923 
     924     ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     925     (( RET=RET+$? )) 
    925926 
    926927    if [ ${RET} -gt 0 ] ; then 
     
    988989    echo "IGCM_sys_Put_Out :" $@ 
    989990  fi 
     991 
     992  typeset NB_ESSAI DELAI RET i exist skip 
     993 
     994  # number of tentative 
     995  NB_ESSAI=3 
     996  # time delay between tentative 
     997  DELAI=2 
     998 
    990999  if [ $DRYRUN = 0 ]; then 
    9911000    if [ ! -f ${1} ] ; then 
     
    9971006    IGCM_sys_MkdirArchive $( dirname $2 ) 
    9981007    # 
    999     typeset RET exist skip 
    10001008 
    10011009    #===================================================== 
     
    10071015    #    typeset WORKPATH FILEPATH 
    10081016    #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 
    1009     #    IGCM_sys_MkdirWork ${WORKPATH}  
     1017    #    IGCM_sys_MkdirWork ${WORKPATH} 
    10101018    #    FILEPATH=${WORKPATH}/$( basename $2 ) 
    10111019    #    # 
     
    10151023    if [ X${JobType} = XRUN ] ; then 
    10161024      if [ X${3} = X ] ; then 
    1017         IGCM_sys_Chmod 444 ${1} 
     1025        IGCM_sys_Chmod 444 ${1} 
    10181026      fi 
    10191027    fi 
     1028    # 
    10201029 
    10211030    exist=false 
     
    10271036      exist=true 
    10281037      if [ "X$( diff $1 $2 )" = X ] ; then 
    1029         IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 
    1030         skip=true 
     1038        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 
     1039        skip=true 
    10311040      else 
    1032         IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 
    1033         skip=false 
     1041        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 
     1042        skip=false 
    10341043      fi 
    10351044    fi 
    1036     #  
     1045    # 
    10371046    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 
    10381047      IGCM_sys_Chmod u+w $2 
    10391048    fi 
    1040     # USUAL WAY 
     1049 
    10411050    if [ X${skip} = Xfalse ] ; then 
    1042       \cp $1 $2 > out_rsync 2>&1 
    1043       RET=$? 
    1044       if [ ${RET} -gt 0 ] ; then 
    1045         echo "IGCM_sys_Put_Out : error." 
    1046         cat out_rsync 
    1047         IGCM_debug_Exit "IGCM_sys_Put_Out" 
    1048       else 
    1049         \rm out_rsync 
    1050       fi 
    1051     fi 
    1052  
    1053 #       #RSYNC WITH NETWORK SSH CALL 
    1054 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
    1055 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
    1056  
    1057 #       #RSYNC WITH NFS USE 
    1058 #       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
    1059 #       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    1060  
    1061 #       RET=$? 
    1062 #       IGCM_sys_Rsync_out $RET 
    1063  
    1064 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1065 #       (( RET=RET+$? )) 
    1066  
     1051      (( i = 0 )) 
     1052      while [ $i -lt $NB_ESSAI ] ; do 
     1053        # USUAL WAY 
     1054        \cp $1 $2 > out_rsync 2>&1 
     1055        RET=$? 
     1056        if [ ${RET} -gt 0 ]; then 
     1057          IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}" 
     1058          IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 
     1059          sleep $DELAI 
     1060        else 
     1061          break 
     1062        fi 
     1063        (( i = i + 1 )) 
     1064      done 
     1065    fi 
     1066 
     1067#       #RSYNC WITH NETWORK SSH CALL 
     1068#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     1069#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     1070 
     1071#       #RSYNC WITH NFS USE 
     1072#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     1073#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     1074 
     1075#       RET=$? 
     1076#       IGCM_sys_Rsync_out $RET 
     1077 
     1078#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1079#       (( RET=RET+$? )) 
     1080 
     1081    if [ ${RET} -gt 0 ] ; then 
     1082      echo "IGCM_sys_Put_Out : error." 
     1083      cat out_rsync 
     1084      IGCM_debug_Exit "IGCM_sys_Put_Out" 
     1085    else 
     1086      \rm out_rsync 
     1087    fi 
    10671088  else 
    10681089    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     
    10951116    if [ X${JobType} = XRUN ] ; then 
    10961117      if [ X${3} = X ] ; then 
    1097         IGCM_sys_Chmod 444 ${1} 
     1118        IGCM_sys_Chmod 444 ${1} 
    10981119      fi 
    10991120    fi 
     
    11251146  IGCM_debug_PushStack "IGCM_sys_Get" $@ 
    11261147 
    1127   typeset DEST RET dm_liste ifile target file_work  
     1148  typeset DEST RET dm_liste ifile target file_work 
     1149  typeset NB_ESSAI DELAI status i 
    11281150 
    11291151  if ( $DEBUG_sys ) ; then 
    11301152    echo "IGCM_sys_Get :" $@ 
    11311153  fi 
     1154 
     1155  # number of tentative 
     1156  NB_ESSAI=3 
     1157  # time delay between tentative 
     1158  DELAI=2 
     1159 
    11321160  if [ $DRYRUN -le 2 ]; then 
    11331161    if [ X${1} = X'/l' ] ; then 
     
    11551183    #fi 
    11561184 
    1157     # test if the (first) file is present in the old computation : 
    1158     IGCM_sys_TestFileArchive ${dm_liste[0]} 
    1159     RET=$? 
    1160     if [ ${RET} -gt 0 ] ; then 
    1161       echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 
    1162       IGCM_debug_Exit "IGCM_sys_Get" 
    1163     fi 
    1164  
    1165     #dmget ${dm_liste[*]} > out_rsync 2>&1 
    11661185    ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 
    11671186    RET=$? 
    1168  
    11691187    if [ ${RET} -gt 0 ] ; then 
    11701188      echo "WARNING IGCM_sys_Get : demigration error." 
     
    11831201    #   RET=$? 
    11841202    #   if [ ${RET} -gt 0 ] ; then 
    1185     #       echo "ERROR IGCM_sys_Get : again demigration error :" 
    1186     #       cat out_rsync 
    1187     #       IGCM_debug_Exit "IGCM_sys_Get" 
     1203    #       echo "ERROR IGCM_sys_Get : again demigration error :" 
     1204    #       cat out_rsync 
     1205    #       IGCM_debug_Exit "IGCM_sys_Get" 
    11881206    #   fi 
    11891207    #    else 
     
    11981216      (( RET=0 )) 
    11991217      for target in ${dm_liste[*]} ; do 
    1200         local_file=$( basename ${target} ) 
    1201         \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1202         (( RET = RET + $? )) 
     1218        local_file=$( basename ${target} ) 
     1219        (( i = 0 )) 
     1220        # test if the target file is present before the loop 
     1221        IGCM_sys_TestFileArchive ${target} 
     1222        RET=$? 
     1223        if [ ${RET} -gt 0 ] ; then 
     1224          echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 
     1225          IGCM_debug_Exit "IGCM_sys_Get" 
     1226        else 
     1227          while [ $i -lt $NB_ESSAI ] ; do 
     1228            \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1229            status=$? 
     1230            if [ ${status} -gt 0 ]; then 
     1231              IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}" 
     1232              IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 
     1233              sleep $DELAI 
     1234            else 
     1235              break 
     1236            fi 
     1237            (( i = i + 1 )) 
     1238          done 
     1239          (( RET = RET + status )) 
     1240        fi 
    12031241      done 
    12041242    else 
     
    12071245    fi 
    12081246 
    1209 #       #RSYNC WITH NETWORK SSH CALL 
    1210 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
    1211 #       ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    1212  
    1213      #RSYNC WITH NFS USE 
    1214      echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 
    1215      ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    1216  
    1217 #       RET=$? 
    1218      IGCM_sys_Rsync_out $RET 
    1219  
    1220      ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1221      (( RET=RET+$? )) 
     1247#       #RSYNC WITH NETWORK SSH CALL 
     1248#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
     1249#       ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
     1250 
     1251     #RSYNC WITH NFS USE 
     1252     echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 
     1253     ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
     1254 
     1255#       RET=$? 
     1256     IGCM_sys_Rsync_out $RET 
     1257 
     1258     ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1259     (( RET=RET+$? )) 
    12221260 
    12231261    if [ ${RET} -gt 0 ] ; then 
     
    12421280  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
    12431281 
    1244   typeset DEST RET buf_liste ifile target file_work  
     1282  typeset DEST RET buf_liste ifile target file_work 
    12451283 
    12461284  if ( $DEBUG_sys ) ; then 
     
    12601298      (( RET=0 )) 
    12611299      for target in ${buf_liste[*]} ; do 
    1262         local_file=$( basename ${target} ) 
    1263         \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1264         (( RET = RET + $? )) 
     1300        local_file=$( basename ${target} ) 
     1301        \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1302        (( RET = RET + $? )) 
    12651303      done 
    12661304    else 
     
    12981336#D-#================================================== 
    12991337#D-function IGCM_sys_GetDate_FichArchive 
    1300 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE  
     1338#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
    13011339#D-* Examples: 
    13021340#D- 
     
    13111349#D-#================================================== 
    13121350#D-function IGCM_sys_Dods_Rm 
    1313 #D-* Purpose: DO NOTHING ! Put $(ARCHIVE) files on DODS internet protocole. 
     1351#D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. 
    13141352#D-* Examples: 
    13151353#D- 
     
    13301368    /ccc/cont003/home/dsm/p86ipsl/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 
    13311369    RET=$? 
    1332      
     1370 
    13331371#       if [ ${RET} -gt 0 ] ; then 
    1334 #           echo "IGCM_sys_Dods_Rm : error." 
    1335 #           cat out_dods_rm 
    1336 #           IGCM_debug_Exit "IGCM_sys_Dods_Rm" 
     1372#           echo "IGCM_sys_Dods_Rm : error." 
     1373#           cat out_dods_rm 
     1374#           IGCM_debug_Exit "IGCM_sys_Dods_Rm" 
    13371375#       else 
    1338 #           rm out_dods_rm 
     1376#           rm out_dods_rm 
    13391377#       fi 
    13401378 
     
    13671405    RET=$? 
    13681406 
    1369 #       if [ ${RET} -gt 0 ] ; then 
    1370 #           echo "IGCM_sys_Dods_Cp : error." 
    1371 #           cat out_dods_cp 
    1372 #           IGCM_debug_Exit "IGCM_sys_Dods_Cp" 
    1373 #       else 
    1374 #           rm out_dods_cp 
    1375 #       fi 
     1407#       if [ ${RET} -gt 0 ] ; then 
     1408#           echo "IGCM_sys_Dods_Cp : error." 
     1409#           cat out_dods_cp 
     1410#           IGCM_debug_Exit "IGCM_sys_Dods_Cp" 
     1411#       else 
     1412#           rm out_dods_cp 
     1413#       fi 
    13761414 
    13771415  else 
     
    14181456    IGCM_sys_Dods_Cp ${1} 
    14191457    RET=0 
    1420      
     1458 
    14211459    if [ ${RET} -gt 0 ] ; then 
    14221460      echo "IGCM_sys_Put_Dods : error." 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh

    r669 r676  
    12111211    echo "IGCM_sys_Put_Out :" $@ 
    12121212  fi 
     1213 
     1214  typeset NB_ESSAI DELAI RET i 
     1215 
     1216  # number of tentative 
     1217  NB_ESSAI=3 
     1218  # time delay between tentative 
     1219  DELAI=2 
     1220 
    12131221  if [ $DRYRUN = 0 ]; then 
    12141222    if [ ! -f ${1} ] ; then 
     
    12201228    IGCM_sys_MkdirArchive $( dirname $2 ) 
    12211229    # 
    1222     typeset RET 
    12231230 
    12241231    #===================================================== 
     
    12421249    fi 
    12431250    # 
     1251 
     1252    (( i = 0 )) 
     1253    while [ $i -lt $NB_ESSAI ] ; do 
    12441254    # USUAL WAY 
    1245     \cp $1 $2 > out_rsync 2>&1 
    1246     RET=$? 
     1255      \cp $1 $2 > out_rsync 2>&1 
     1256      RET=$? 
     1257      if [ ${RET} -gt 0 ]; then 
     1258        IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}" 
     1259        IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 
     1260        sleep $DELAI 
     1261      else 
     1262        break 
     1263      fi 
     1264      (( i = i + 1 )) 
     1265    done 
    12471266 
    12481267#       #RSYNC WITH NETWORK SSH CALL 
     
    13281347 
    13291348  typeset DEST RET dm_liste ifile target file_work 
     1349  typeset NB_ESSAI DELAI status i 
    13301350 
    13311351  if ( $DEBUG_sys ) ; then 
    13321352    echo "IGCM_sys_Get :" $@ 
    13331353  fi 
     1354 
     1355  # number of tentative 
     1356  NB_ESSAI=3 
     1357  # time delay between tentative 
     1358  DELAI=2 
     1359 
    13341360  if [ $DRYRUN -le 2 ]; then 
    13351361    if [ X${1} = X'/l' ] ; then 
     
    13571383    #fi 
    13581384 
    1359     # test if the (first) file is present in the old computation : 
    1360     IGCM_sys_TestFileArchive ${dm_liste[0]} 
    1361     RET=$? 
    1362     if [ ${RET} -gt 0 ] ; then 
    1363       echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 
    1364       IGCM_debug_Exit "IGCM_sys_Get" 
    1365     fi 
    1366  
    1367     #dmget ${dm_liste[*]} > out_rsync 2>&1 
    13681385    ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 
    13691386    RET=$? 
     
    14001417      for target in ${dm_liste[*]} ; do 
    14011418        local_file=$( basename ${target} ) 
    1402         \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1403         (( RET = RET + $? )) 
     1419        (( i = 0 )) 
     1420        # test if the target file is present before the loop 
     1421        IGCM_sys_TestFileArchive ${target} 
     1422        RET=$? 
     1423        if [ ${RET} -gt 0 ] ; then 
     1424          echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 
     1425          IGCM_debug_Exit "IGCM_sys_Get" 
     1426        else 
     1427          while [ $i -lt $NB_ESSAI ] ; do 
     1428            \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1429            status=$? 
     1430            if [ ${status} -gt 0 ]; then 
     1431              IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}" 
     1432              IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 
     1433              sleep $DELAI 
     1434            else 
     1435              break 
     1436            fi 
     1437            (( i = i + 1 )) 
     1438          done 
     1439          (( RET = RET + status )) 
     1440        fi 
    14041441      done 
    14051442    else 
Note: See TracChangeset for help on using the changeset viewer.