Index: trunk/libIGCM/AA_job
===================================================================
--- trunk/libIGCM/AA_job	(revision 91)
+++ trunk/libIGCM/AA_job	(revision 92)
@@ -121,9 +121,9 @@
 #D- Define running directory
 #D- Default=${TMPDIR} ie temporary batch directory
-#RUN_DIR_PATH=/workdir4/rech/ces/rces452/BABATEST/TESTPOST
+#RUN_DIR_PATH=/workdir/of/this/machine
 
 #D- Define submit directory
-#D- Default= where you launch qsub
-#SUBMIT_DIR=/workdir4/rech/ces/rces452/SCRIPT_V1/modipsl/config/IPSLCM4_v1_OASIS3/EXP01
+#D- Default= where you launch qsub (variable from scheduler)
+#SUBMIT_DIR=$( pwd )
 
 #D- Turn in dry run mode ? (0,1,2,3)
@@ -146,5 +146,5 @@
 
 #D- Define input file root directory
-#D- Default=/u/rech/ces/rces452/IGCM
+#D- Default=/IGCMG/common/account/of/this/machine
 #R_IN=/u/rech/por/rpor111/DATA
 
@@ -209,9 +209,9 @@
 #D-  
 # --------------------------------------------------------------------==
-if [ "${config_Post_RebuildFromArchive}" = "true" ]; then
+if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then
     REBUILD_DIR=${R_SAVE}/TMP
     IGCM_sys_MkdirArchive ${REBUILD_DIR}
 else
-    REBUILD_DIR=\${RUN_DIR}
+    REBUILD_DIR=${RUN_DIR}
 fi
 
@@ -231,6 +231,7 @@
 
 # --------------------------------------------------------------------==
-#D- Verify compatibility of period length and write frequencies
-#D-
+#D- Verify compatibility of period length, write frequencies, ...
+#D- Verify compatibility of rebuild choices and post-process choices
+#D- Will stop here if something is wrong
 # --------------------------------------------------------------------==
 #IGCM_config_Check
Index: trunk/libIGCM/libIGCM_card/IGCM_card_PrintOption.awk
===================================================================
--- trunk/libIGCM/libIGCM_card/IGCM_card_PrintOption.awk	(revision 91)
+++ trunk/libIGCM/libIGCM_card/IGCM_card_PrintOption.awk	(revision 92)
@@ -1,4 +1,2 @@
-#!/usr/bin/awk -f
-
 #**************************************************************
 # Author: Patrick Brockmann
Index: trunk/libIGCM/libIGCM_card/IGCM_card_PrintSection.awk
===================================================================
--- trunk/libIGCM/libIGCM_card/IGCM_card_PrintSection.awk	(revision 91)
+++ trunk/libIGCM/libIGCM_card/IGCM_card_PrintSection.awk	(revision 92)
@@ -1,4 +1,2 @@
-#!/usr/bin/awk -f
-
 #**************************************************************
 # Author: Patrick Brockmann
Index: trunk/libIGCM/libIGCM_card/IGCM_card_WriteOption.awk
===================================================================
--- trunk/libIGCM/libIGCM_card/IGCM_card_WriteOption.awk	(revision 91)
+++ trunk/libIGCM/libIGCM_card/IGCM_card_WriteOption.awk	(revision 92)
@@ -1,4 +1,2 @@
-#!/usr/bin/awk -f
-
 #**************************************************************
 # Author: Patrick Brockmann
Index: trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh
===================================================================
--- trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh	(revision 91)
+++ trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh	(revision 92)
@@ -510,5 +510,5 @@
 	fi
     done
-    IGCM_sys_Chmod -R u+rw .
+    IGCM_sys_Chmod u+rw *
 
     IGCM_debug_PopStack "IGCM_comp_GetInputRestartFiles"
Index: trunk/libIGCM/libIGCM_config/libIGCM_config.ksh
===================================================================
--- trunk/libIGCM/libIGCM_config/libIGCM_config.ksh	(revision 91)
+++ trunk/libIGCM/libIGCM_config/libIGCM_config.ksh	(revision 92)
@@ -490,5 +490,5 @@
 	if [ $RET -eq 0 ] ; then
 	    # ExeCpuLog variable contents 5 fields
-	    echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${ExeCpuLog} ${ExeDate}" | \
+	    echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${ExeCpuLog} ${ExeDate}" |   \
 	     awk '{printf("# %11d | %15s | %15s | %19s | %19s | %15.5f | %15.5f | %15.5f | %s\n", \
                               $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/run.card
@@ -504,9 +504,8 @@
 
     # If all was OK, we can delete all files not necessary for next Job
-    echo "Files that will be deleted before next period-run : "
+    IGCM_debug_Print 1 "Files that will be deleted before next period-run : "
 
     if [ ${DRYRUN} -le 2 ] ; then
-	eval ls -la ${FileToBeDeleted[@]}
-	eval rm -f ${FileToBeDeleted[@]}
+	for f in ${FileToBeDeleted[@]} ; do ls -la $f ; rm -f $f ; done
     else
 	echo ${FileToBeDeleted[@]}
Index: trunk/libIGCM/libIGCM_post/libIGCM_post.ksh
===================================================================
--- trunk/libIGCM/libIGCM_post/libIGCM_post.ksh	(revision 91)
+++ trunk/libIGCM/libIGCM_post/libIGCM_post.ksh	(revision 92)
@@ -442,6 +442,8 @@
     #
     if [ ${RebuildFrequency} = true ] ; then
-        #
-        IGCM_debug_Print 2 "REBUILD POST-TREATMENT :"
+	#
+        if ( [ ${config_Post_RebuildFromArchive} = true ] ) ; then
+        #
+        IGCM_debug_Print 2 "REBUILD POST-TREATMENT FROM ARCHIVE:"
         echo
         #
@@ -474,4 +476,31 @@
         IGCM_sys_QsubPost rebuild
 EOF
+        else 
+        #
+        IGCM_debug_Print 2 "REBUILD POST-TREATMENT FROM WORKDIR :"
+        echo
+        #
+        typeset listVarEnv
+        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,RebuildFromArchive,POST_DIR,MASTER,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF"
+        export DEBUG_debug=${DEBUG_debug}
+        export MODIPSL=${MODIPSL}
+        export libIGCM_SX=${libIGCM}
+        export libIGCM=${libIGCM}
+        export SUBMIT_DIR=${SUBMIT_DIR}
+        export RebuildFromArchive=${config_Post_RebuildFromArchive}
+        export REBUILD_DIR=${REBUILD_DIR}
+        export POST_DIR=${libIGCM}
+        export DateBegin=${DateBegin}
+        export PeriodDateBegin=${PeriodDateBegin}
+        export PeriodDateEnd=${PeriodDateEnd}
+        export NbRebuildDir=${NbRebuildDir}
+        export StandAlone=false
+        export RESOL_ATM=${RESOL_ATM}
+        export RESOL_OCE=${RESOL_OCE}
+        export RESOL_ICE=${RESOL_ICE}
+        export RESOL_SRF=${RESOL_SRF}
+        export listVarEnv=${listVarEnv}
+        IGCM_sys_Qsub rebuildtmp.job ${libIGCM}
+        fi
     fi
 
Index: trunk/libIGCM/libIGCM_sys/libIGCM_sys_brodie.ksh
===================================================================
--- trunk/libIGCM/libIGCM_sys/libIGCM_sys_brodie.ksh	(revision 91)
+++ trunk/libIGCM/libIGCM_sys/libIGCM_sys_brodie.ksh	(revision 92)
@@ -641,4 +641,29 @@
 
 #D-#==================================================
+#D-function IGCM_sys_Rm
+#D-* Purpose: generic rm
+#D-* Examples:
+#D-
+function IGCM_sys_Rm {
+    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
+    if ( $DEBUG_sys ) ; then
+        echo "IGCM_sys_Rm :" $@
+    fi
+
+    typeset RET
+
+    echo rm $@ > out_rsync 2>&1
+    \rm $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+        echo "IGCM_sys_Rm : error."
+        cat out_rsync
+        IGCM_debug_Exit "IGCM_sys_Rm"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rm"
+}
+
+#D-#==================================================
 #D-function IGCM_sys_Mv
 #D-* Purpose: generic move
Index: trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh
===================================================================
--- trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 91)
+++ trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 92)
@@ -597,4 +597,29 @@
 
 #D-#==================================================
+#D-function IGCM_sys_Rm
+#D-* Purpose: generic rm
+#D-* Examples:
+#D-
+function IGCM_sys_Rm {
+    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
+    if ( $DEBUG_sys ) ; then
+        echo "IGCM_sys_Rm :" $@
+    fi
+
+    typeset RET
+
+    echo rm $@ > out_rsync 2>&1
+    \rm $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+        echo "IGCM_sys_Rm : error."
+        cat out_rsync
+        IGCM_debug_Exit "IGCM_sys_Rm"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rm"
+}
+
+#D-#==================================================
 #D-function IGCM_sys_Mv
 #D-* Purpose: generic move
Index: trunk/libIGCM/libIGCM_sys/libIGCM_sys_platine.ksh
===================================================================
--- trunk/libIGCM/libIGCM_sys/libIGCM_sys_platine.ksh	(revision 91)
+++ trunk/libIGCM/libIGCM_sys/libIGCM_sys_platine.ksh	(revision 92)
@@ -652,4 +652,29 @@
     IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
     if ( $DEBUG_sys ) ; then
+        echo "IGCM_sys_Rm :" $@
+    fi
+
+    typeset RET
+
+    echo rm $@ > out_rsync 2>&1
+    \rm $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+        echo "IGCM_sys_Rm : error."
+        cat out_rsync
+        IGCM_debug_Exit "IGCM_sys_Rm"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rm"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Rm
+#D-* Purpose: generic rm
+#D-* Examples:
+#D-
+function IGCM_sys_Rm {
+    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
+    if ( $DEBUG_sys ) ; then
 	echo "IGCM_sys_Rm :" $@
     fi
Index: trunk/libIGCM/libIGCM_sys/libIGCM_sys_vargas.ksh
===================================================================
--- trunk/libIGCM/libIGCM_sys/libIGCM_sys_vargas.ksh	(revision 91)
+++ trunk/libIGCM/libIGCM_sys/libIGCM_sys_vargas.ksh	(revision 92)
@@ -430,5 +430,8 @@
 	echo "IGCM_sys_Qsub :" $@
     fi
-    { cd $LOADL_STEP_INITDIR ; llsubmit $1 ; }
+    {
+      [ ${#@} = 1 ] &&  { cd $LOADL_STEP_INITDIR ; llsubmit $1 ; cd - ; }
+      [ ${#@} = 2 ] &&  { cd $2 ; llsubmit $1 ; cd - ; }
+    }
     if [ $? -gt 0 ] ; then
 	echo "IGCM_sys_Qsub : erreur $@."
@@ -449,5 +452,5 @@
     fi
     cd ${POST_DIR}
-    /opt/ibmll/LoadL/full/bin/llsubmit ${libIGCM_POST}/$1.job
+    /usr/local/bin/llsubmit ${libIGCM_POST}/$1.job
     cd -
     if [ $? -gt 0 ] ; then
@@ -643,4 +646,29 @@
 
 #D-#==================================================
+#D-function IGCM_sys_Rm
+#D-* Purpose: generic rm
+#D-* Examples:
+#D-
+function IGCM_sys_Rm {
+    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
+    if ( $DEBUG_sys ) ; then
+        echo "IGCM_sys_Rm :" $@
+    fi
+
+    typeset RET
+
+    echo rm $@ > out_rsync 2>&1
+    \rm $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+        echo "IGCM_sys_Rm : error."
+        cat out_rsync
+        IGCM_debug_Exit "IGCM_sys_Rm"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rm"
+}
+
+#D-#==================================================
 #D-function IGCM_sys_Mv
 #D-* Purpose: generic move
