Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_cesium.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_cesium.ksh	(revision 675)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_cesium.ksh	(revision 676)
@@ -1,3 +1,3 @@
-#!/bin/ksh 
+#!/bin/ksh
 
 #**************************************************************
@@ -14,5 +14,5 @@
 #=========================================================
 # The documentation of this file can be automatically generated
-# if you use the prefix #D- for comments to be extracted. 
+# if you use the prefix #D- for comments to be extracted.
 # Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
 #=========================================================
@@ -22,5 +22,5 @@
 #D-#==================================================
 #D-
-#D- This ksh library if a layer under some usefull 
+#D- This ksh library if a layer under some usefull
 #D-environment variables and shell commands.
 #D-All those definitions depend on host particularities.
@@ -62,5 +62,5 @@
 
 #=====================================================
-# Host and user names 
+# Host and user names
 # $hostname ou hostname
 typeset  HOST=${HOST:=$( hostname )}
@@ -104,5 +104,5 @@
 
 #====================================================
-# For interactive jobs on cesium 
+# For interactive jobs on cesium
 PBS_O_WORKDIR=${PBS_O_WORKDIR:=$(pwd)}
 
@@ -117,6 +117,4 @@
 #- ARCHIVE (dedicated to small/medium files)
 typeset -r STORAGE=${CCCWORKDIR}
-
-#====================================================
 
 #====================================================
@@ -327,5 +325,5 @@
   fi
   #- creation de repertoire sur le serveur fichier
-  if [ ! -d ${1} ]; then 
+  if [ ! -d ${1} ]; then
     \mkdir -p $1
     if [ $? -gt 0 ] ; then
@@ -348,5 +346,5 @@
   fi
   #- creation de repertoire sur le serveur fichier
-  if [ ! -d ${1} ]; then 
+  if [ ! -d ${1} ]; then
     \mkdir -p $1
     if [ $? -gt 0 ] ; then
@@ -511,5 +509,5 @@
 #D-#==================================================
 #D-function IGCM_sys_CountFileBuffer
-#D-* Purpose: Count files on Master Scratch filesystem
+#D-* Purpose: Count files on Scratch filesystem
 #D-* Examples:
 #D-
@@ -612,5 +610,5 @@
 
 #D-*************************
-#D- File transfer functions 
+#D- File transfer functions
 #D-*************************
 #D-
@@ -681,5 +679,5 @@
   elif [ $MYLANG = "en" ] ; then
     case $RET in
-    0)  return;;		
+    0)  return;;
     1)  echo "rsync error : Syntax or usage error "
       return;;
@@ -822,9 +820,9 @@
 
     typeset RET
-    
+
     echo mv $@ > out_rsync 2>&1
     \mv $@ >> out_rsync 2>&1
     RET=$?
-    
+
     if [ ${RET} -gt 0 ] ; then
       echo "IGCM_sys_Mv : error in mv."
@@ -934,5 +932,5 @@
 
     typeset TEST NB_ESSAI DELAI status i
-    
+
     TEST=$( IGCM_sys_RshMaster ( [ -d $1 ] || [ -f $1 ] ) && echo 1 || echo 0 )
     if [ ${TEST} -ne 1 ] ; then
@@ -949,13 +947,13 @@
     (( i = 0 ))
     while [ $i -lt $NB_ESSAI ] ; do
-	    #USUAL WAY
+            #USUAL WAY
       scp -r ${MASTER}:$1 $2 > out_rsync 2>&1
       status=$?
       if [ ${status} -gt 0 ]; then
-	IGCM_debug_Print 2 "IGCM_sys_Get_Master : scp failed ${i}/${NB_ESSAI}"
-	IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again."
-	sleep $DELAI
+        IGCM_debug_Print 2 "IGCM_sys_Get_Master : scp failed ${i}/${NB_ESSAI}"
+        IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again."
+        sleep $DELAI
       else
-	break
+        break
       fi
       (( i = i + 1 ))
@@ -1003,17 +1001,17 @@
     RET=$?
 
-# 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
-
-#  	#RSYNC WITH NFS USE
-#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
-#  	${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
-
-#  	RET=$?
-#  	IGCM_sys_Rsync_out $RET
-
-#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
-#  	(( RET=RET+$? ))
+#       #RSYNC WITH NETWORK SSH CALL
+#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
+
+#       #RSYNC WITH NFS USE
+#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+
+#       RET=$?
+#       IGCM_sys_Rsync_out $RET
+
+#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#       (( RET=RET+$? ))
 
     if [ ${RET} -gt 0 ] ; then
@@ -1040,4 +1038,12 @@
     echo "IGCM_sys_Put_Out :" $@
   fi
+
+  typeset NB_ESSAI DELAI RET i exist skip
+
+  # number of tentative
+  NB_ESSAI=3
+  # time delay between tentative
+  DELAI=2
+
   if [ $DRYRUN = 0 ]; then
     if [ ! -f ${1} ] ; then
@@ -1049,5 +1055,4 @@
     IGCM_sys_MkdirArchive $( dirname $2 )
     #
-    typeset RET exist skip
 
     #=====================================================
@@ -1059,5 +1064,5 @@
     #    typeset WORKPATH FILEPATH
     #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" )
-    #    IGCM_sys_MkdirWork ${WORKPATH} 
+    #    IGCM_sys_MkdirWork ${WORKPATH}
     #    FILEPATH=${WORKPATH}/$( basename $2 )
     #    #
@@ -1067,7 +1072,8 @@
     if [ X${JobType} = XRUN ] ; then
       if [ X${3} = X ] ; then
-	IGCM_sys_Chmod 444 ${1}
+        IGCM_sys_Chmod 444 ${1}
       fi
     fi
+    #
 
     exist=false
@@ -1079,43 +1085,54 @@
       exist=true
       if [ "X$( diff $1 $2 )" = X ] ; then
-	IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy"
-	skip=true
+        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy"
+        skip=true
       else
-	IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy"
-	skip=false
+        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy"
+        skip=false
       fi
     fi
-        # 
+    #
     if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then
       IGCM_sys_Chmod u+w $2
     fi
-	# USUAL WAY
+
     if [ X${skip} = Xfalse ] ; then
-      cp $1 $2 > out_rsync 2>&1
-      RET=$?
-      if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Put_Out : error."
-	cat out_rsync
-	IGCM_debug_Exit "IGCM_sys_Put_Out"
-      else
-	\rm out_rsync
-      fi
-    fi
-
-# 	#RSYNC WITH NETWORK RSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
-
-#  	#RSYNC WITH NFS USE
-#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
-#  	${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
-
-#  	RET=$?
-#  	IGCM_sys_Rsync_out $RET
-
-#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
-#  	(( RET=RET+$? ))
-
-
+      (( i = 0 ))
+      while [ $i -lt $NB_ESSAI ] ; do
+        # USUAL WAY
+        \cp $1 $2 > out_rsync 2>&1
+        RET=$?
+        if [ ${RET} -gt 0 ]; then
+          IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}"
+          IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again."
+          sleep $DELAI
+        else
+          break
+        fi
+        (( i = i + 1 ))
+      done
+    fi
+
+#       #RSYNC WITH NETWORK RSH CALL
+#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#       #RSYNC WITH NFS USE
+#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+
+#       RET=$?
+#       IGCM_sys_Rsync_out $RET
+
+#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#       (( RET=RET+$? ))
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Out : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Out"
+    else
+      \rm out_rsync
+    fi
   else
     ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
@@ -1133,9 +1150,16 @@
   IGCM_debug_PushStack "IGCM_sys_Get" $@
 
-  typeset DEST RET dm_liste ifile target file_work 
+  typeset DEST RET dm_liste ifile target file_work
+  typeset NB_ESSAI DELAI status i
 
   if ( $DEBUG_sys ) ; then
     echo "IGCM_sys_Get :" $@
   fi
+
+  # number of tentative
+  NB_ESSAI=3
+  # time delay between tentative
+  DELAI=2
+
   if [ $DRYRUN -le 2 ]; then
     if [ X${1} = X'/l' ] ; then
@@ -1163,13 +1187,4 @@
     #fi
 
-    # test if the (first) file is present in the old computation :
-    IGCM_sys_TestFileArchive ${dm_liste[0]}
-    RET=$?
-    if [ ${RET} -gt 0 ] ; then
-      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
-      IGCM_debug_Exit "IGCM_sys_Get"
-    fi
-
-    #dmget ${dm_liste[*]} > out_rsync 2>&1
     ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
     RET=$?
@@ -1190,7 +1205,7 @@
     #	RET=$?
     #	if [ ${RET} -gt 0 ] ; then
-    #	    echo "ERROR IGCM_sys_Get : again demigration error :"
-    #	    cat out_rsync
-    #	    IGCM_debug_Exit "IGCM_sys_Get"
+    #       echo "ERROR IGCM_sys_Get : again demigration error :"
+    #       cat out_rsync
+    #       IGCM_debug_Exit "IGCM_sys_Get"
     #	fi
     #    else
@@ -1205,7 +1220,27 @@
       (( RET=0 ))
       for target in ${dm_liste[*]} ; do
-	local_file=$( basename ${target} )
-	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
-	(( RET = RET + $? ))
+        local_file=$( basename ${target} )
+        (( i = 0 ))
+        # test if the target file is present before the loop
+        IGCM_sys_TestFileArchive ${target}
+        RET=$?
+        if [ ${RET} -gt 0 ] ; then
+          echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+          IGCM_debug_Exit "IGCM_sys_Get"
+        else
+          while [ $i -lt $NB_ESSAI ] ; do
+            \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+            status=$?
+            if [ ${status} -gt 0 ]; then
+              IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}"
+              IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again."
+              sleep $DELAI
+            else
+              break
+            fi
+            (( i = i + 1 ))
+          done
+          (( RET = RET + status ))
+        fi
       done
     else
@@ -1214,17 +1249,17 @@
     fi
 
-# 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
-
-#  	#RSYNC WITH NFS USE
-#  	echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
-#  	${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1
-
-# 	RET=$?
-#  	IGCM_sys_Rsync_out $RET
-
-#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
-#  	(( RET=RET+$? ))
+#       #RSYNC WITH NETWORK SSH CALL
+#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#       #RSYNC WITH NFS USE
+#       echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#       RET=$?
+#       IGCM_sys_Rsync_out $RET
+
+#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#       (( RET=RET+$? ))
 
     if [ ${RET} -gt 0 ] ; then
@@ -1249,5 +1284,5 @@
   IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@
 
-  typeset DEST RET buf_liste ifile target file_work 
+  typeset DEST RET buf_liste ifile target file_work
 
   if ( $DEBUG_sys ) ; then
@@ -1267,7 +1302,7 @@
       (( RET=0 ))
       for target in ${buf_liste[*]} ; do
-	local_file=$( basename ${target} )
-	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
-	(( RET = RET + $? ))
+        local_file=$( basename ${target} )
+        \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+        (( RET = RET + $? ))
       done
     else
@@ -1299,5 +1334,5 @@
     echo "IGCM_sys_GetDate_FichWork :" $@
   fi
-    # donne la date filesys d'un fichier sur la machine work
+  # donne la date filesys d'un fichier sur la machine work
   IGCM_debug_PopStack "IGCM_sys_FichWork"
 }
@@ -1305,5 +1340,5 @@
 #D-#==================================================
 #D-function IGCM_sys_GetDate_FichArchive
-#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE
 #D-* Examples:
 #D-
@@ -1337,11 +1372,11 @@
     /ccc/cont003/home/dsm/p86maf/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1
     RET=$?
-    
+
 #	if [ ${RET} -gt 0 ] ; then
-#	    echo "IGCM_sys_Dods_Rm : error."
-#	    cat out_dods_rm
-#	    IGCM_debug_Exit "IGCM_sys_Dods_Rm"
+#           echo "IGCM_sys_Dods_Rm : error."
+#           cat out_dods_rm
+#           IGCM_debug_Exit "IGCM_sys_Dods_Rm"
 #	else
-#	    rm out_dods_rm
+#           rm out_dods_rm
 #	fi
 
@@ -1363,5 +1398,4 @@
   typeset RET
   RET=0
-
   if [ $DRYRUN = 0 ]; then
 
@@ -1375,11 +1409,11 @@
     RET=$?
 
-# 	if [ ${RET} -gt 0 ] ; then
-# 	    echo "IGCM_sys_Dods_Cp : error."
-# 	    cat out_dods_cp
-# 	    IGCM_debug_Exit "IGCM_sys_Dods_Cp"
-# 	else
-# 	    rm out_dods_cp
-# 	fi
+#       if [ ${RET} -gt 0 ] ; then
+#           echo "IGCM_sys_Dods_Cp : error."
+#           cat out_dods_cp
+#           IGCM_debug_Exit "IGCM_sys_Dods_Cp"
+#       else
+#           rm out_dods_cp
+#       fi
 
   else
@@ -1401,5 +1435,4 @@
   typeset RET
   if [ $DRYRUN = 0 ]; then
-
     if ( [ ! -d ${R_SAVE}/${1} ] && [ ! -d ${R_FIGR}/${1} ] ) ; then
       echo "WARNING IGCM_sys_Put_Dods : None of the following directories exist. Exactly one should."
@@ -1427,5 +1460,5 @@
     IGCM_sys_Dods_Cp ${1}
     RET=0
-    
+
     if [ ${RET} -gt 0 ] ; then
       echo "IGCM_sys_Put_Dods : error."
@@ -1494,5 +1527,5 @@
     IGCM_debug_PushStack "IGCM_sys_check_quota"
     if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_check_quota"
+        echo "IGCM_sys_check_quota"
     fi
     IGCM_debug_PopStack "IGCM_sys_check_quota"
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh	(revision 675)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh	(revision 676)
@@ -203,4 +203,5 @@
 (( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL ))
 DEFAULT_NUM_PROC_TOTAL=${BATCH_NUM_PROC_TOT}
+
 
 #D-#==================================================
@@ -1016,9 +1017,9 @@
     typeset RET
 
-        # Only if we use rsync
-        #IGCM_sys_TestDirArchive $( dirname $2 )
-        #
-        #USUAL WAY
-        # add get (to demigrate all offline files) to reduce time of this command :
+    # Only if we use rsync
+    #IGCM_sys_TestDirArchive $( dirname $2 )
+    #
+    #USUAL WAY
+    # add get (to demigrate all offline files) to reduce time of this command :
     ccc_hsm get $1/*
     \cp -r $1 $2 > out_rsync 2>&1
@@ -1225,9 +1226,9 @@
       RET=$?
       if [ ${RET} -gt 0 ]; then
-	IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}"
-	IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again."
-	sleep $DELAI
+        IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}"
+        IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again."
+        sleep $DELAI
       else
-	break
+        break
       fi
       (( i = i + 1 ))
@@ -1398,9 +1399,9 @@
             status=$?
             if [ ${status} -gt 0 ]; then
-	      IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}"
-	      IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again."
-	      sleep $DELAI
+              IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}"
+              IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again."
+              sleep $DELAI
             else
-	      break
+              break
             fi
             (( i = i + 1 ))
@@ -2004,3 +2005,2 @@
     IGCM_debug_PopStack "IGCM_sys_check_quota"
 }
-
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 675)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 676)
@@ -1,3 +1,3 @@
-#!/bin/ksh 
+#!/bin/ksh
 
 #**************************************************************
@@ -14,5 +14,5 @@
 #=========================================================
 # The documentation of this file can be automatically generated
-# if you use the prefix #D- for comments to be extracted. 
+# if you use the prefix #D- for comments to be extracted.
 # Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
 #=========================================================
@@ -22,5 +22,5 @@
 #D-#==================================================
 #D-
-#D- This ksh library if a layer under some usefull 
+#D- This ksh library if a layer under some usefull
 #D-environment variables and shell commands.
 #D-All those definitions depend on host particularities.
@@ -94,5 +94,5 @@
 
 #====================================================
-# For interactive jobs on mercure 
+# For interactive jobs on mercure
 PBS_O_WORKDIR=${PBS_O_WORKDIR:=$(pwd)}
 
@@ -220,4 +220,5 @@
     status=completed
   fi
+
   cat  << END_MAIL > job_end.mail
 Dear ${LOGIN},
@@ -281,5 +282,5 @@
   fi
   #- creation de repertoire sur le serveur fichier
-  if [ ! -d ${1} ]; then 
+  if [ ! -d ${1} ]; then
     \mkdir -p $1
     if [ $? -gt 0 ] ; then
@@ -302,5 +303,5 @@
   fi
   #- creation de repertoire sur le serveur fichier
-  if [ ! -d ${1} ]; then 
+  if [ ! -d ${1} ]; then
     \mkdir -p $1
     if [ $? -gt 0 ] ; then
@@ -548,5 +549,5 @@
 
 #D-*************************
-#D- File transfer functions 
+#D- File transfer functions
 #D-*************************
 #D-
@@ -617,5 +618,5 @@
   elif [ $MYLANG = "en" ] ; then
     case $RET in
-    0)  return;;		
+    0)  return;;
     1)  echo "rsync error : Syntax or usage error "
       return;;
@@ -746,9 +747,9 @@
 
     typeset RET
-    
+
     echo mv $@ > out_rsync 2>&1
     \mv $@ >> out_rsync 2>&1
     RET=$?
-    
+
     if [ ${RET} -gt 0 ] ; then
       echo "IGCM_sys_Mv : error in mv."
@@ -806,5 +807,5 @@
 #D-#==================================================
 #D-function IGCM_sys_Get_Dir
-#D-* Purpose: Copy a complete directory from $(ARCHIVE)
+#D-* Purpose: Copy a complete directory from ${ARCHIVE}
 #D-* Examples:
 #D-
@@ -815,9 +816,9 @@
   fi
   if [ $DRYRUN = 0 ]; then
-#	if [ ! -d ${1} ] ; then
-#	    echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
-#	    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
-#	    return
-#	fi
+#    if [ ! -d ${1} ] ; then
+#      echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
+#      IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+#      return
+#    fi
 
     typeset RET
@@ -910,17 +911,17 @@
     RET=$?
 
-# 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
-
-#  	#RSYNC WITH NFS USE
-#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
-#  	${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
-
-#  	RET=$?
-#  	IGCM_sys_Rsync_out $RET
-
-#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
-#  	(( RET=RET+$? ))
+#       #RSYNC WITH NETWORK SSH CALL
+#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
+
+#       #RSYNC WITH NFS USE
+#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+
+#       RET=$?
+#       IGCM_sys_Rsync_out $RET
+
+#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#       (( RET=RET+$? ))
 
     if [ ${RET} -gt 0 ] ; then
@@ -988,4 +989,12 @@
     echo "IGCM_sys_Put_Out :" $@
   fi
+
+  typeset NB_ESSAI DELAI RET i exist skip
+
+  # number of tentative
+  NB_ESSAI=3
+  # time delay between tentative
+  DELAI=2
+
   if [ $DRYRUN = 0 ]; then
     if [ ! -f ${1} ] ; then
@@ -997,5 +1006,4 @@
     IGCM_sys_MkdirArchive $( dirname $2 )
     #
-    typeset RET exist skip
 
     #=====================================================
@@ -1007,5 +1015,5 @@
     #    typeset WORKPATH FILEPATH
     #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" )
-    #    IGCM_sys_MkdirWork ${WORKPATH} 
+    #    IGCM_sys_MkdirWork ${WORKPATH}
     #    FILEPATH=${WORKPATH}/$( basename $2 )
     #    #
@@ -1015,7 +1023,8 @@
     if [ X${JobType} = XRUN ] ; then
       if [ X${3} = X ] ; then
-	IGCM_sys_Chmod 444 ${1}
+        IGCM_sys_Chmod 444 ${1}
       fi
     fi
+    #
 
     exist=false
@@ -1027,42 +1036,54 @@
       exist=true
       if [ "X$( diff $1 $2 )" = X ] ; then
-	IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy"
-	skip=true
+        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy"
+        skip=true
       else
-	IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy"
-	skip=false
+        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy"
+        skip=false
       fi
     fi
-    # 
+    #
     if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then
       IGCM_sys_Chmod u+w $2
     fi
-    # USUAL WAY
+
     if [ X${skip} = Xfalse ] ; then
-      \cp $1 $2 > out_rsync 2>&1
-      RET=$?
-      if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Put_Out : error."
-	cat out_rsync
-	IGCM_debug_Exit "IGCM_sys_Put_Out"
-      else
-	\rm out_rsync
-      fi
-    fi
-
-# 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
-
-#  	#RSYNC WITH NFS USE
-#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
-#  	${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
-
-#  	RET=$?
-#  	IGCM_sys_Rsync_out $RET
-
-#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
-#  	(( RET=RET+$? ))
-
+      (( i = 0 ))
+      while [ $i -lt $NB_ESSAI ] ; do
+        # USUAL WAY
+        \cp $1 $2 > out_rsync 2>&1
+        RET=$?
+        if [ ${RET} -gt 0 ]; then
+          IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}"
+          IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again."
+          sleep $DELAI
+        else
+          break
+        fi
+        (( i = i + 1 ))
+      done
+    fi
+
+#       #RSYNC WITH NETWORK SSH CALL
+#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
+
+#       #RSYNC WITH NFS USE
+#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+
+#       RET=$?
+#       IGCM_sys_Rsync_out $RET
+
+#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#       (( RET=RET+$? ))
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Out : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Out"
+    else
+      \rm out_rsync
+    fi
   else
     ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
@@ -1095,5 +1116,5 @@
     if [ X${JobType} = XRUN ] ; then
       if [ X${3} = X ] ; then
-	IGCM_sys_Chmod 444 ${1}
+        IGCM_sys_Chmod 444 ${1}
       fi
     fi
@@ -1125,9 +1146,16 @@
   IGCM_debug_PushStack "IGCM_sys_Get" $@
 
-  typeset DEST RET dm_liste ifile target file_work 
+  typeset DEST RET dm_liste ifile target file_work
+  typeset NB_ESSAI DELAI status i
 
   if ( $DEBUG_sys ) ; then
     echo "IGCM_sys_Get :" $@
   fi
+
+  # number of tentative
+  NB_ESSAI=3
+  # time delay between tentative
+  DELAI=2
+
   if [ $DRYRUN -le 2 ]; then
     if [ X${1} = X'/l' ] ; then
@@ -1155,16 +1183,6 @@
     #fi
 
-    # test if the (first) file is present in the old computation :
-    IGCM_sys_TestFileArchive ${dm_liste[0]}
-    RET=$?
-    if [ ${RET} -gt 0 ] ; then
-      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
-      IGCM_debug_Exit "IGCM_sys_Get"
-    fi
-
-    #dmget ${dm_liste[*]} > out_rsync 2>&1
     ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
     RET=$?
-
     if [ ${RET} -gt 0 ] ; then
       echo "WARNING IGCM_sys_Get : demigration error."
@@ -1183,7 +1201,7 @@
     #	RET=$?
     #	if [ ${RET} -gt 0 ] ; then
-    #	    echo "ERROR IGCM_sys_Get : again demigration error :"
-    #	    cat out_rsync
-    #	    IGCM_debug_Exit "IGCM_sys_Get"
+    #       echo "ERROR IGCM_sys_Get : again demigration error :"
+    #       cat out_rsync
+    #       IGCM_debug_Exit "IGCM_sys_Get"
     #	fi
     #    else
@@ -1198,7 +1216,27 @@
       (( RET=0 ))
       for target in ${dm_liste[*]} ; do
-	local_file=$( basename ${target} )
-	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
-	(( RET = RET + $? ))
+        local_file=$( basename ${target} )
+        (( i = 0 ))
+        # test if the target file is present before the loop
+        IGCM_sys_TestFileArchive ${target}
+        RET=$?
+        if [ ${RET} -gt 0 ] ; then
+          echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+          IGCM_debug_Exit "IGCM_sys_Get"
+        else
+          while [ $i -lt $NB_ESSAI ] ; do
+            \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+            status=$?
+            if [ ${status} -gt 0 ]; then
+              IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}"
+              IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again."
+              sleep $DELAI
+            else
+              break
+            fi
+            (( i = i + 1 ))
+          done
+          (( RET = RET + status ))
+        fi
       done
     else
@@ -1207,17 +1245,17 @@
     fi
 
-# 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
-
-#  	#RSYNC WITH NFS USE
-#  	echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
-#  	${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1
-
-# 	RET=$?
-#  	IGCM_sys_Rsync_out $RET
-
-#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
-#  	(( RET=RET+$? ))
+#       #RSYNC WITH NETWORK SSH CALL
+#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#       #RSYNC WITH NFS USE
+#       echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#       RET=$?
+#       IGCM_sys_Rsync_out $RET
+
+#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#       (( RET=RET+$? ))
 
     if [ ${RET} -gt 0 ] ; then
@@ -1242,5 +1280,5 @@
   IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@
 
-  typeset DEST RET buf_liste ifile target file_work 
+  typeset DEST RET buf_liste ifile target file_work
 
   if ( $DEBUG_sys ) ; then
@@ -1260,7 +1298,7 @@
       (( RET=0 ))
       for target in ${buf_liste[*]} ; do
-	local_file=$( basename ${target} )
-	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
-	(( RET = RET + $? ))
+        local_file=$( basename ${target} )
+        \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+        (( RET = RET + $? ))
       done
     else
@@ -1298,5 +1336,5 @@
 #D-#==================================================
 #D-function IGCM_sys_GetDate_FichArchive
-#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE
 #D-* Examples:
 #D-
@@ -1311,5 +1349,5 @@
 #D-#==================================================
 #D-function IGCM_sys_Dods_Rm
-#D-* Purpose: DO NOTHING ! Put $(ARCHIVE) files on DODS internet protocole.
+#D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole.
 #D-* Examples:
 #D-
@@ -1330,11 +1368,11 @@
     /ccc/cont003/home/dsm/p86ipsl/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1
     RET=$?
-    
+
 #	if [ ${RET} -gt 0 ] ; then
-#	    echo "IGCM_sys_Dods_Rm : error."
-#	    cat out_dods_rm
-#	    IGCM_debug_Exit "IGCM_sys_Dods_Rm"
+#           echo "IGCM_sys_Dods_Rm : error."
+#           cat out_dods_rm
+#           IGCM_debug_Exit "IGCM_sys_Dods_Rm"
 #	else
-#	    rm out_dods_rm
+#           rm out_dods_rm
 #	fi
 
@@ -1367,11 +1405,11 @@
     RET=$?
 
-# 	if [ ${RET} -gt 0 ] ; then
-# 	    echo "IGCM_sys_Dods_Cp : error."
-# 	    cat out_dods_cp
-# 	    IGCM_debug_Exit "IGCM_sys_Dods_Cp"
-# 	else
-# 	    rm out_dods_cp
-# 	fi
+#       if [ ${RET} -gt 0 ] ; then
+#           echo "IGCM_sys_Dods_Cp : error."
+#           cat out_dods_cp
+#           IGCM_debug_Exit "IGCM_sys_Dods_Cp"
+#       else
+#           rm out_dods_cp
+#       fi
 
   else
@@ -1418,5 +1456,5 @@
     IGCM_sys_Dods_Cp ${1}
     RET=0
-    
+
     if [ ${RET} -gt 0 ] ; then
       echo "IGCM_sys_Put_Dods : error."
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh	(revision 675)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh	(revision 676)
@@ -1211,4 +1211,12 @@
     echo "IGCM_sys_Put_Out :" $@
   fi
+
+  typeset NB_ESSAI DELAI RET i
+
+  # number of tentative
+  NB_ESSAI=3
+  # time delay between tentative
+  DELAI=2
+
   if [ $DRYRUN = 0 ]; then
     if [ ! -f ${1} ] ; then
@@ -1220,5 +1228,4 @@
     IGCM_sys_MkdirArchive $( dirname $2 )
     #
-    typeset RET
 
     #=====================================================
@@ -1242,7 +1249,19 @@
     fi
     #
+
+    (( i = 0 ))
+    while [ $i -lt $NB_ESSAI ] ; do
     # USUAL WAY
-    \cp $1 $2 > out_rsync 2>&1
-    RET=$?
+      \cp $1 $2 > out_rsync 2>&1
+      RET=$?
+      if [ ${RET} -gt 0 ]; then
+	IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}"
+	IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again."
+	sleep $DELAI
+      else
+	break
+      fi
+      (( i = i + 1 ))
+    done
 
 #       #RSYNC WITH NETWORK SSH CALL
@@ -1328,8 +1347,15 @@
 
   typeset DEST RET dm_liste ifile target file_work
+  typeset NB_ESSAI DELAI status i
 
   if ( $DEBUG_sys ) ; then
     echo "IGCM_sys_Get :" $@
   fi
+
+  # number of tentative
+  NB_ESSAI=3
+  # time delay between tentative
+  DELAI=2
+
   if [ $DRYRUN -le 2 ]; then
     if [ X${1} = X'/l' ] ; then
@@ -1357,13 +1383,4 @@
     #fi
 
-    # test if the (first) file is present in the old computation :
-    IGCM_sys_TestFileArchive ${dm_liste[0]}
-    RET=$?
-    if [ ${RET} -gt 0 ] ; then
-      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
-      IGCM_debug_Exit "IGCM_sys_Get"
-    fi
-
-    #dmget ${dm_liste[*]} > out_rsync 2>&1
     ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
     RET=$?
@@ -1400,6 +1417,26 @@
       for target in ${dm_liste[*]} ; do
         local_file=$( basename ${target} )
-        \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
-        (( RET = RET + $? ))
+        (( i = 0 ))
+        # test if the target file is present before the loop
+        IGCM_sys_TestFileArchive ${target}
+        RET=$?
+        if [ ${RET} -gt 0 ] ; then
+          echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+          IGCM_debug_Exit "IGCM_sys_Get"
+        else
+          while [ $i -lt $NB_ESSAI ] ; do
+            \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+            status=$?
+            if [ ${status} -gt 0 ]; then
+	      IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}"
+	      IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again."
+	      sleep $DELAI
+            else
+	      break
+            fi
+            (( i = i + 1 ))
+          done
+          (( RET = RET + status ))
+        fi
       done
     else
