Index: /trunk/libIGCM/AA_RunChecker
===================================================================
--- /trunk/libIGCM/AA_RunChecker	(revision 761)
+++ /trunk/libIGCM/AA_RunChecker	(revision 762)
@@ -31,6 +31,10 @@
   fg_new=false
 
-  NbOcc=$( awk -v JobName=${JobName} \
-           'BEGIN {x=0}  $1 ~ JobName {++x} END {print x}' ${SimuCatalog} )
+  if [ ! X${JobName} == X ] ; then
+    NbOcc=$( awk -v JobName=${JobName} \
+             'BEGIN {x=0}  $1 ~ JobName {++x} END {print x}' ${SimuCatalog} )
+  else
+    NbOcc=0
+  fi
 
   if ( [ ${NbOcc} -eq 0 ] && ( $fg_path ) ) ; then
@@ -163,5 +167,5 @@
     printf "| JobName = ${ColExp}%-${#JobName}s${ColNon}" ${JobName}
     printf "%-${len}s" ${Dum} 
-    printf "run.card : ${ColExp}%-17s${ColNon}|\n" "${LastWrite} "
+    printf "run.card : ${ColExp}%-18s${ColNon}|\n" "${LastWrite}"
     echo "|-------------------------|-------------|-------------------------|-------------|-----:----------:----------|"
     echo "|                         |             |                         |             |     Pending Rebuilds      |"
@@ -199,8 +203,10 @@
     fi
 
-    printf "|-----------------------------------------------------------------------------------------------------------|\n"
-    printf "|                                                      Last                                                 |\n"
-    printf "|     Rebuild      |   Pack_Output    |   Pack_Restart   |    Pack_Debug    |  Monitoring  |     Atlas      |\n"
-    printf "|------------------|------------------|------------------|------------------|--------------|----------------|\n"
+    if [ ${NbLines} -gt 0 ] ; then
+      printf "|-----------------------------------------------------------------------------------------------------------|\n"
+      printf "|                                                      Last                                                 |\n"
+      printf "|     Rebuild      |   Pack_Output    |   Pack_Restart   |    Pack_Debug    |  Monitoring  |     Atlas      |\n"
+      printf "|------------------|------------------|------------------|------------------|--------------|----------------|\n"
+    fi
 
     return
@@ -292,6 +298,6 @@
   case $1 in
     -h|--help|-help)
-      echo "usage: $0 [-u user] [-n] [-q] [-j n] job_name"
-      echo "       $0 [-u user] [-n] [-q] [-j n] -p config.card_path"
+      echo "usage: $0 [-u user] [-q] [-j n] [-s] job_name"
+      echo "       $0 [-u user] [-q] [-j n] -p config.card_path"
       echo ""
       echo "options :"
@@ -302,23 +308,23 @@
       echo "  -s : search for a new job in \$WORKDIR and fill in "
       echo "       the catalog before printing information"
-      echo "  -p : give the config.card path to a new simulation, "
-      echo "       instead of the job name."
+      echo "  -p : give the directory (absolute path) containing "
+      echo "       the config.card instead of the job name."
       exit ;;
 #    -b|-nocolor)
 #      fg_color=false
 #      shift 1 ;;
-    -s|-search)
-      fg_search=true
-      shift 1 ;;
-    -q|-quiet)
-      fg_quiet=true
-      shift 1 ;;
+    -j|-job-number)
+      NbHisto="$2"
+      shift 2 ;;
     -p|-config-path)
       ConfigPath="$2"
       fg_path=true
       shift 2 ;;
-    -j|-job-number)
-      NbHisto="$2"
-      shift 2 ;;
+    -q|-quiet)
+      fg_quiet=true
+      shift 1 ;;
+    -s|-search)
+      fg_search=true
+      shift 1 ;;
     -u|-user)
       TargetUsr="$2"
@@ -418,15 +424,16 @@
   SpaceName=${config_UserChoices_SpaceName}
 
-  IGCM_card_DefineVariableFromOption ${RunFile} Configuration CumulPeriod
-  CumulPeriod=${run_Configuration_CumulPeriod}
 
   if ( [ ! X${PeriodState} == XWaiting ] && [ ! X${PeriodState} == XCompleted ] ) ; then
     IGCM_card_DefineVariableFromOption ${RunFile} Configuration PeriodDateBegin
     IGCM_card_DefineVariableFromOption ${RunFile} Configuration PeriodDateEnd
+  IGCM_card_DefineVariableFromOption ${RunFile} Configuration CumulPeriod
     PeriodDateBegin=${run_Configuration_PeriodDateBegin}
     PeriodDateEnd=${run_Configuration_PeriodDateEnd}
+    CumulPeriod=${run_Configuration_CumulPeriod}
   else
     PeriodDateBegin="."
     PeriodDateEnd="."
+    CumulPeriod="."
   fi
 
@@ -479,92 +486,100 @@
 
 
-  # Check last REBUILD and PACK* jobs
-  # =================================
-  # Define input parameters
-  # -----------------------
-  set -A JobType_list "${RebuildJob}" "pack_output" "pack_restart" "pack_debug"
-
-  for JobType in ${JobType_list[*]} ; do 
-    typeset    name1="${JobType}_String"
-    typeset    name2="${JobType}_Field"
-    if [ X${JobType} == X${RebuildJob} ] ; then
-      eval ${name1}=IGCM_sys_PutBuffer_Out
-      eval ${name2}=4
-    else
-      eval ${name1}=IGCM_sys_Put_Out
-      eval ${name2}=3
-    fi
-  done
-
-  #Â Check jobs
-  # ----------
-  NbLines=0
-  for JobType in ${JobType_list[*]} ; do 
-    eval String=\${${JobType}_String}
-    eval Field=\${${JobType}_Field}
-
-    set -A FileList $( ls ${POST_DIR}/${JobType}.*.out | tail -n ${NbHisto} )
-
-    if [ ${#FileList[*]} -gt ${NbLines} ] ; then
-      NbLines=${#FileList[*]}
-    fi
-
-    (( ind = 0 ))
-    for FileName in ${FileList[*]} ; do
-      LastDate=$( basename ${FileName} | awk -F"." '{ print $(NF-1) }' )
-
-      Error=$( awk -v String=${String} \
-                   'BEGIN { x=0 } ($1~String) && ($3~"error.") { x=x+1 } END { print x }' \
-                   ${POST_DIR}/${JobType}.${LastDate}.out )
-
-      Match=$( awk -v String=${String} \
-                   'BEGIN { x=0 } ($1~String) && ($3!~"error.") { x=x+1 } END { print x }' \
-                   ${POST_DIR}/${JobType}.${LastDate}.out )
-      (( Nb = ${Match} - ${Error} ))
-
-      if ( [ ${Error} -eq 0 ] && [ ${Nb} -gt 0 ] ) ; then
-        Status=OK
+  if [ $PeriodState != "Waiting" ] ; then
+
+    # Check last REBUILD and PACK* jobs
+    # =================================
+    # Define input parameters
+    # -----------------------
+    set -A JobType_list "${RebuildJob}" "pack_output" "pack_restart" "pack_debug"
+
+    for JobType in ${JobType_list[*]} ; do 
+      typeset    name1="${JobType}_String"
+      typeset    name2="${JobType}_Field"
+      if [ X${JobType} == X${RebuildJob} ] ; then
+        eval ${name1}=IGCM_sys_PutBuffer_Out
+        eval ${name2}=4
       else
-        Status=KO
+        eval ${name1}=IGCM_sys_Put_Out
+        eval ${name2}=3
       fi
-
-      eval ${JobType}_Date[$ind]=${LastDate}
-      eval ${JobType}_Status[$ind]=${Status}
-      eval ${JobType}_Nb[$ind]=${Nb}
-      
-      (( ind = ind + 1 ))
     done
-  done
-
-  # Check last MONITORING jobs
-  # ==========================
-  JobType=monitoring
-  if [ -d ${CWORK_DIR}/MONITORING ] ; then
-    LastDate=$( cdo showyear ${CWORK_DIR}/MONITORING/files/ATM_bils_global_ave.nc 2> /dev/null | \
-                    awk '{ print $NF }' )
-    eval ${JobType}_Date=${LastDate}
-  fi
-
-  # Check last ATLAS jobs
-  # =====================
-  JobType=atlas
-  if [ -d ${CWORK_DIR}/ATLAS ] ; then
-    set -A FileList $( ls ${CWORK_DIR}/ATLAS | tail -n ${NbHisto} )
-
-    if [ ${#FileList[*]} -gt ${NbLines} ] ; then
-      NbLines=${#FileList[*]}
-    fi
-
-    (( ind = 0 ))
-    for FileName in ${FileList[*]} ; do
-      eval ${JobType}_Date[$ind]=${FileName}
-      (( ind = ind + 1 ))
+
+    #Â Check jobs
+    # ----------
+    NbLines=0
+    for JobType in ${JobType_list[*]} ; do 
+      eval String=\${${JobType}_String}
+      eval Field=\${${JobType}_Field}
+
+      set -A FileList $( ls ${POST_DIR}/${JobType}.*.out | tail -n ${NbHisto} )
+
+      if [ ${#FileList[*]} -gt ${NbLines} ] ; then
+        NbLines=${#FileList[*]}
+      fi
+
+      (( ind = 0 ))
+      for FileName in ${FileList[*]} ; do
+        LastDate=$( basename ${FileName} | awk -F"." '{ print $(NF-1) }' )
+
+        Error=$( awk -v String=${String} \
+                     'BEGIN { x=0 } ($1~String) && ($3~"error.") { x=x+1 } END { print x }' \
+                     ${POST_DIR}/${JobType}.${LastDate}.out )
+
+        Match=$( awk -v String=${String} \
+                     'BEGIN { x=0 } ($1~String) && ($3!~"error.") { x=x+1 } END { print x }' \
+                     ${POST_DIR}/${JobType}.${LastDate}.out )
+        (( Nb = ${Match} - ${Error} ))
+
+        if ( [ ${Error} -eq 0 ] && [ ${Nb} -gt 0 ] ) ; then
+          Status=OK
+        else
+          Status=KO
+        fi
+
+        eval ${JobType}_Date[$ind]=${LastDate}
+        eval ${JobType}_Status[$ind]=${Status}
+        eval ${JobType}_Nb[$ind]=${Nb}
+        
+        (( ind = ind + 1 ))
+      done
     done
-  fi
-
-
-  # Time of last write on run.card
-  # ==============================
-  LastWrite=$( ls -l --time-style=+"${DateFormat}" ${SUBMIT_DIR}/run.card | awk '{print $6 " " $7}' )
+
+    # Check last MONITORING jobs
+    # ==========================
+    JobType=monitoring
+    if [ -d ${CWORK_DIR}/MONITORING ] ; then
+      LastDate=$( cdo showyear ${CWORK_DIR}/MONITORING/files/ATM_bils_global_ave.nc 2> /dev/null | \
+                      awk '{ print $NF }' )
+      eval ${JobType}_Date=${LastDate}
+    fi
+
+    # Check last ATLAS jobs
+    # =====================
+    JobType=atlas
+    if [ -d ${CWORK_DIR}/ATLAS ] ; then
+      set -A FileList $( ls ${CWORK_DIR}/ATLAS | tail -n ${NbHisto} )
+
+      if [ ${#FileList[*]} -gt ${NbLines} ] ; then
+        NbLines=${#FileList[*]}
+      fi
+
+      (( ind = 0 ))
+      for FileName in ${FileList[*]} ; do
+        eval ${JobType}_Date[$ind]=${FileName}
+        (( ind = ind + 1 ))
+      done
+    fi
+
+
+    # Time of last write on run.card
+    # ==============================
+    LastWrite=$( ls -l --time-style=+"${DateFormat}" ${SUBMIT_DIR}/run.card | awk '{print $6 " " $7}' )
+
+  else
+
+    NbLines=0
+
+  fi
     
 
