Ignore:
Timestamp:
10/16/12 13:04:38 (12 years ago)
Author:
sdipsl
Message:
  • curie, titane, mercurex9, mercure : minor bugfixes coming from r716 and r717. Further systematic loop over cp command
  • obelix, vargas, ulam : cosmetics
File:
1 edited

Legend:

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

    r716 r719  
    712712#D-  Error values and explanations can depend on your system version. 
    713713function IGCM_sys_Rsync_out { 
    714   RET=$1 
    715   if [ ! $RET ] ; then 
     714  status=$1 
     715  if [ ! $status ] ; then 
    716716    echo "rsync error !" 
    717717  fi 
    718718 
    719719  if [ $MYLANG = "fr" ]; then 
    720     case $RET in 
     720    case $status in 
    721721    0)  return ;; 
    722722    1)  echo "Erreur de rsync ; RERR_SYNTAX : " 
     
    766766      echo "Temps d'attente écoulé dans l'envoi/réception de données" 
    767767      return;; 
    768     *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 
     768    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $status 
    769769      return;; 
    770770    esac 
    771771  elif [ $MYLANG = "en" ] ; then 
    772     case $RET in 
     772    case $status in 
    773773    0)  return;; 
    774774    1)  echo "rsync error : Syntax or usage error " 
     
    807807    30) echo "rsync error : Timeout in data send/receive " 
    808808      return;; 
    809     *)  echo "rsync error : return code of rsync unknown :" $RET 
     809    *)  echo "rsync error : return code of rsync unknown :" $status 
    810810      return;; 
    811811    esac 
     
    12751275 
    12761276    if [ X${skip} = Xfalse ] ; then 
    1277       (( i = 0 )) 
     1277      i=0 
    12781278      while [ $i -lt $NB_ESSAI ] ; do 
    12791279        # USUAL WAY 
     
    14101410  IGCM_debug_PushStack "IGCM_sys_Get" $@ 
    14111411 
    1412   typeset DEST RET dm_liste ifile target file_work 
     1412  typeset DEST dm_liste ifile target file_work 
    14131413  typeset NB_ESSAI DELAI status i 
    14141414 
     
    14761476    #fi 
    14771477 
     1478    #   #RSYNC WITH NETWORK SSH CALL 
     1479    #   echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
     1480    #   ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
     1481 
     1482    #   #RSYNC WITH NFS USE 
     1483    #   echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 
     1484    #   ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
     1485 
     1486    #   status=$? 
     1487    #   IGCM_sys_Rsync_out $status 
     1488 
     1489    #   ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1490    #   (( status=status+$? )) 
     1491 
    14781492    #USUAL WAY 
    14791493    if [ X${1} = X'/l' ] ; then 
    1480       (( RET=0 )) 
    14811494      for target in ${dm_liste[*]} ; do 
    14821495        local_file=$( basename ${target} ) 
    1483         (( i = 0 )) 
    14841496        # test if the target file is present before the loop 
    14851497        IGCM_sys_TestFileArchive ${target} 
     
    14891501          IGCM_debug_Exit "IGCM_sys_Get" 
    14901502        else 
     1503          i=0 
    14911504          while [ $i -lt $NB_ESSAI ] ; do 
    14921505            \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     
    15011514            (( i = i + 1 )) 
    15021515          done 
    1503           (( RET = RET + status )) 
     1516          if [ ${status} -gt 0 ] ; then 
     1517            echo "IGCM_sys_Get : error" 
     1518            cat out_rsync 
     1519            \rm out_rsync 
     1520            IGCM_debug_Exit "IGCM_sys_Get" 
     1521          else 
     1522            \rm out_rsync 
     1523          fi 
    15041524        fi 
    15051525      done 
    15061526    else 
    1507       \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 
    1508       status=$? 
    1509     fi 
    1510  
    1511 #       #RSYNC WITH NETWORK SSH CALL 
    1512 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
    1513 #       ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    1514  
    1515 #       #RSYNC WITH NFS USE 
    1516 #       echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 
    1517 #       ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    1518  
    1519 #       status=$? 
    1520 #       IGCM_sys_Rsync_out $status 
    1521  
    1522 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1523 #       (( RET=RET+$? )) 
    1524  
    1525     if [ ${RET} -gt 0 ] ; then 
    1526       echo "IGCM_sys_Get : error" 
    1527       cat out_rsync 
    1528       \rm out_rsync 
    1529       IGCM_debug_Exit "IGCM_sys_Get" 
    1530     else 
    1531       \rm out_rsync 
     1527      i=0 
     1528      while [ $i -lt $NB_ESSAI ] ; do 
     1529        \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 
     1530        status=$? 
     1531        if [ ${status} -gt 0 ]; then 
     1532          IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1533          IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 
     1534          sleep $DELAI 
     1535        else 
     1536          break 
     1537        fi 
     1538        (( i = i + 1 )) 
     1539      done 
     1540      if [ ${status} -gt 0 ] ; then 
     1541        echo "IGCM_sys_Get : error" 
     1542        cat out_rsync 
     1543        \rm out_rsync 
     1544        IGCM_debug_Exit "IGCM_sys_Get" 
     1545      else 
     1546        \rm out_rsync 
     1547      fi 
    15321548    fi 
    15331549  else 
     
    15451561  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
    15461562 
    1547   typeset DEST RET status buf_liste ifile target file_work 
     1563  typeset DEST buf_liste ifile target file_work 
     1564  typeset NB_ESSAI DELAI status i 
    15481565 
    15491566  if ( $DEBUG_sys ) ; then 
    15501567    echo "IGCM_sys_GetBuffer :" $@ 
    15511568  fi 
     1569 
     1570  # number of tentative 
     1571  NB_ESSAI=3 
     1572  # time delay between tentative 
     1573  DELAI=2 
     1574 
    15521575  if [ $DRYRUN -le 2 ]; then 
    15531576    if [ X${1} = X'/l' ] ; then 
     
    15611584    #USUAL WAY 
    15621585    if [ X${1} = X'/l' ] ; then 
    1563       (( RET=0 )) 
    15641586      for target in ${buf_liste[*]} ; do 
    15651587        local_file=$( basename ${target} ) 
    1566         \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1567         (( RET = RET + $? )) 
     1588        i=0 
     1589        while [ $i -lt $NB_ESSAI ] ; do 
     1590          \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1591          status=$? 
     1592          if [ ${status} -gt 0 ]; then 
     1593            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1594            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." 
     1595            sleep $DELAI 
     1596          else 
     1597            break 
     1598          fi 
     1599          (( i = i + 1 )) 
     1600        done 
     1601        if [ ${status} -gt 0 ] ; then 
     1602          echo "IGCM_sys_Get : error" 
     1603          cat out_rsync 
     1604          \rm out_rsync 
     1605          IGCM_debug_Exit "IGCM_sys_GetBuffer" 
     1606        else 
     1607          \rm out_rsync 
     1608        fi 
    15681609      done 
    15691610    else 
    1570       \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
    1571       status=$? 
    1572     fi 
    1573  
    1574     if [ ${RET} -gt 0 ] ; then 
    1575       echo "IGCM_sys_GetBuffer : error" 
    1576       cat out_rsync 
    1577       \rm out_rsync 
    1578       IGCM_debug_Exit "IGCM_sys_GetBuffer" 
    1579     else 
    1580       \rm out_rsync 
     1611      i=0 
     1612      while [ $i -lt $NB_ESSAI ] ; do 
     1613        \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
     1614        status=$? 
     1615        if [ ${status} -gt 0 ]; then 
     1616          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1617          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." 
     1618          sleep $DELAI 
     1619        else 
     1620          break 
     1621        fi 
     1622        (( i = i + 1 )) 
     1623      done 
     1624      if [ ${status} -gt 0 ] ; then 
     1625        echo "IGCM_sys_Get : error" 
     1626        cat out_rsync 
     1627        \rm out_rsync 
     1628        IGCM_debug_Exit "IGCM_sys_GetBuffer" 
     1629      else 
     1630        \rm out_rsync 
     1631      fi 
    15811632    fi 
    15821633  else 
Note: See TracChangeset for help on using the changeset viewer.