Index: /trunk/libIGCM/libIGCM_ensemble/libIGCM_ensemble.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_ensemble/libIGCM_ensemble.ksh	(revision 741)
+++ /trunk/libIGCM/libIGCM_ensemble/libIGCM_ensemble.ksh	(revision 742)
@@ -26,10 +26,12 @@
   IGCM_sys_Cp ${SUBMIT_DIR}/run.card.init ${RUN_DIR}
 
-  if [ -f  ${SUBMIT_DIR}/CreatedDir.txt ] ; then
-    IGCM_sys_Cp ${SUBMIT_DIR}/CreatedDir.txt ${RUN_DIR}
-  fi
-  if [ -f  ${SUBMIT_DIR}/Qsub.txt ] ; then
-    IGCM_sys_Cp ${SUBMIT_DIR}/Qsub.txt ${RUN_DIR}
-  fi
+  # Useful?
+  #if [ -f  ${SUBMIT_DIR}/CreatedDir.txt ] ; then
+  #  IGCM_sys_Cp ${SUBMIT_DIR}/CreatedDir.txt ${RUN_DIR}
+  #fi
+  # Useful?
+  #if [ -f  ${SUBMIT_DIR}/Qsub.txt ] ; then
+  #  IGCM_sys_Cp ${SUBMIT_DIR}/Qsub.txt ${RUN_DIR}
+  #fi
 
   IGCM_card_DefineVariableFromOption ${FileName} Ens_PERTURB actif
@@ -202,18 +204,7 @@
         IGCM_sys_Cp Job_${ensemble_Ens_PERTURB_NAME} ${SUBMIT_DIR}/${StartDir}/${MemberDir}/${JobName}
 
-        ##############################
-        # TO BE A SYS FUNCTION BEGIN #
-        ##############################
-
-        # Dump command to be lauched in Qsub.txt
-        echo "cd ${StartDir}/${MemberDir}/ ;"  >> Qsub.txt
-        echo "sed -e 's/PeriodNb=.*/PeriodNb=48/' ${JobName} > ${JobName}.tmp ; " >> Qsub.txt
-        echo "mv ${JobName}.tmp ${JobName} ; " >> Qsub.txt
-        echo "ccc_msub ${JobName} ; cd -"      >> Qsub.txt
-
-        ############################
-        # TO BE A SYS FUNCTION END #
-        ############################
-
+        # Dump command to be lauched
+        echo "cd ${StartDir}/${MemberDir}/ ;"  >> Qsub.${StartDir}.txt
+        echo "${SUBMIT} ${JobName} ; cd -"     >> Qsub.${StartDir}.txt
       fi
 
@@ -226,4 +217,7 @@
       (( i = i + 1 ))
     done
+
+    # Done. Save ${StartDir} submission text file
+    IGCM_sys_Cp ${RUN_DIR}/Qsub.${StartDir}.txt ${SUBMIT_DIR}
 
   # - Next DateBegin
@@ -319,18 +313,7 @@
         IGCM_sys_Cp Job_${ensemble_Ens_PERTURB_NAME} ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir}
 
-        ##############################
-        # TO BE A SYS FUNCTION BEGIN #
-        ##############################
-
-        # Dump command to be lauched in Qsub.txt
-        echo "cd ${StartDir}/${MemberDir}/ ;"  >> Qsub.txt
-        echo "sed -e 's/PeriodNb=.*/PeriodNb=48/' ${JobName} > ${JobName}.tmp ; " >> Qsub.txt
-        echo "mv ${JobName}.tmp ${JobName} ; " >> Qsub.txt
-        echo "ccc_msub ${JobName} ; cd -"      >> Qsub.txt
-
-        ############################
-        # TO BE A SYS FUNCTION END #
-        ############################
-
+        # Dump command to be lauched
+        echo "cd ${StartDir}/${MemberDir}/ ;"  >> Qsub.${StartDir}.txt
+        echo "${SUBMIT} ${JobName} ; cd -"     >> Qsub.${StartDir}.txt
       fi
 
@@ -346,4 +329,7 @@
       (( i = i + 1 ))
     done
+
+    # Done. Save ${StartDir} submission text file
+    IGCM_sys_Cp ${RUN_DIR}/Qsub.${StartDir}.txt ${SUBMIT_DIR}
 
     (( DateNum = DateNum + 1 ))
@@ -373,24 +359,17 @@
   IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Restarts OverRule "n"
 
-  for Comp in ${config_ListOfComponents[*]} ; do
-    IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${Comp} Restart "y"
-    IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${Comp} RestartDate ${HumanRestartDate}
-    IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${Comp} RestartJobName ${ensemble_Ens_PERTURB_INITFROM}
-    IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${Comp} RestartPath ${ensemble_Ens_PERTURB_INITPATH}
+  for comp in ${config_ListOfComponents[*]} ; do
+    IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${comp} Restart "y"
+    IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${comp} RestartDate ${HumanRestartDate}
+    IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${comp} RestartJobName ${ensemble_Ens_PERTURB_INITFROM}
+    IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${comp} RestartPath ${ensemble_Ens_PERTURB_INITPATH}
   done
+
   # ==> Job
-  ##############################
-  # TO BE A SYS FUNCTION BEGIN #
-  ##############################
-
-  #sed -e "s/\(#MSUB -r \)[A-Za-z0-9]*\( *#.*\)/\1 ${MemberDir} \2/"           \
-  #    -e "s/\(#MSUB -o Script_Output_\)[A-Za-z0-9]*\(\.*\)/\1${MemberDir}\2/" \
-  #    -e "s/\(#MSUB -e Script_Output_\)[A-Za-z0-9]*\(\.*\)/\1${MemberDir}\2/" \
-  #    ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir} > Job_${MemberDir}.tmp
-  #IGCM_sys_Mv Job_${MemberDir}.tmp ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir}
-
-  ############################
-  # TO BE A SYS FUNCTION END #
-  ############################
+  sed -e "s/\(#.*\)${ensemble_Ens_PERTURB_NAME}\( *#.*\)/\1${MemberDir} \2/"            \
+      -e "s/\(#.*Script_Output_\)${ensemble_Ens_PERTURB_NAME}\(\.*\)/\1${MemberDir}\2/" \
+      -e "s/^PeriodNb=.*/PeriodNb=48/"                                                  \
+      ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir} > Job_${MemberDir}.tmp
+  IGCM_sys_Mv Job_${MemberDir}.tmp ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir}
 
   IGCM_debug_PopStack "IGCM_ensemble_CastFilesUpdate"
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh	(revision 741)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh	(revision 742)
@@ -75,4 +75,6 @@
 #D-#==================================================
 
+# Submit command
+typeset SUBMIT=${SUBMIT:=ccc_mprun}
 # rsync with path
 typeset -r RSYNC=/usr/bin/rsync
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_default.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_default.ksh	(revision 741)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_default.ksh	(revision 742)
@@ -75,4 +75,6 @@
 #D-#==================================================
 
+# Submit command
+typeset SUBMIT=${SUBMIT:=qsub}
 # rsync with path
 typeset -r RSYNC=/usr/bin/rsync
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 741)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 742)
@@ -73,4 +73,6 @@
 #D-#==================================================
 
+# Submit command
+typeset SUBMIT=${SUBMIT:=qsub}
 # rsync with path
 typeset -r RSYNC=/usr/bin/rsync
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex9.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex9.ksh	(revision 741)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex9.ksh	(revision 742)
@@ -78,4 +78,6 @@
 #D-#==================================================
 
+# Submit command
+typeset SUBMIT=${SUBMIT:=qsub}
 # rsync with path
 typeset -r RSYNC=/home/cont003/p86denv/SX_RSYNC/bin/rsync
@@ -352,10 +354,25 @@
     echo "IGCM_sys_Mkdir :" $@
   fi
+
+  typeset NB_ESSAI DELAI status i
+  # number of tentative
+  NB_ESSAI=3
+  # time delay between tentative
+  DELAI=2
+
   if [ ! -d ${1} ]; then
-    \mkdir -p $1
-    if [ $? -gt 0 ] ; then
-      echo "IGCM_sys_Mkdir : erreur."
-      IGCM_debug_Exit "IGCM_sys_Mkdir"
-    fi
+    i=0
+    while [ $i -lt $NB_ESSAI ] ; do
+      \mkdir -p $1
+      status=$?
+      if [ ${status} -gt 0 ] ; then
+        IGCM_debug_Print 2 "IGCM_sys_Mkdir : mkdir failed error code ${status} ${i}/${NB_ESSAI}"
+        IGCM_debug_Print 2 "IGCM_sys_Mkdir : sleep ${DELAI} seconds and try again."
+        sleep $DELAI
+      else
+        break
+      fi
+      (( i = i + 1 ))
+    done
   fi
   # vérification :
@@ -377,11 +394,31 @@
     echo "IGCM_sys_MkdirArchive :" $@
   fi
-  #- creation de repertoire sur le serveur fichier
+
+  typeset NB_ESSAI DELAI status i
+  # number of tentative
+  NB_ESSAI=3
+  # time delay between tentative
+  DELAI=2
+
   if [ ! -d ${1} ]; then
-    \mkdir -p $1
-    if [ $? -gt 0 ] ; then
-      echo "IGCM_sys_MkdirArchive : erreur."
-      IGCM_debug_Exit "IGCM_sys_MkdirArchive"
-    fi
+    i=0
+    while [ $i -lt $NB_ESSAI ] ; do
+      \mkdir -p $1
+      status=$?
+      if [ ${status} -gt 0 ] ; then
+        IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status} ${i}/${NB_ESSAI}"
+        IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : sleep ${DELAI} seconds and try again."
+        sleep $DELAI
+      else
+        break
+      fi
+      (( i = i + 1 ))
+    done
+  fi
+
+  # vérification :
+  if [ ! -d ${1} ] ; then
+    echo "IGCM_sys_MkdirArchive : erreur."
+    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
   fi
   IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
@@ -600,5 +637,5 @@
     echo "IGCM_sys_Tar :" $@
   fi
-  \tar cf $@
+  IGCM_sys_RshMaster "\tar $@"
   if [ $? -gt 0 ] ; then
     echo "IGCM_sys_Tar : erreur."
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh	(revision 741)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh	(revision 742)
@@ -64,9 +64,9 @@
 # Host and user names
 # $hostname ou hostname
-typeset  HOST=${HOST:=$( hostname )}
+typeset HOST=${HOST:=$( hostname )}
 # $username ou whoami
-typeset  LOGIN=${LOGIN:=$( whoami )}
+typeset LOGIN=${LOGIN:=$( whoami )}
 # $hostname of the MASTER job
-typeset  MASTER=${MASTER:=$( hostname )}
+typeset MASTER=${MASTER:=$( hostname )}
 
 #D-
@@ -75,4 +75,6 @@
 #D-#==================================================
 
+# Submit command
+typeset SUBMIT=${SUBMIT:=qsub}
 # rsync with path
 typeset -r RSYNC=/usr/bin/rsync
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh	(revision 741)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh	(revision 742)
@@ -75,4 +75,6 @@
 #D-#==================================================
 
+# Submit command
+typeset SUBMIT=${SUBMIT:=ccc_mprun}
 # rsync with path
 typeset -r RSYNC=/usr/bin/rsync
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_vargas.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_vargas.ksh	(revision 741)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_vargas.ksh	(revision 742)
@@ -75,4 +75,6 @@
 #D-#==================================================
 
+# Submit command
+typeset SUBMIT=${SUBMIT:=llsubmit}
 # rsync with path
 typeset -r RSYNC=/usr/local/bin/rsync
