#!/usr/bin/ksh
# $Id$
######################################################
# Original : C. Talandier for NEMO team
# Contact  : nemo_st@locean-ipsl.upmc.fr
#
# This script is launched by the lance_batch.ksh script
# for a given configuration.
# It aims to (for each standard configuration) check if
# there are jobs in queue associated with the considered 
# configuration. 
# If jobs are still in queue it re-launched itself either
# it launchs the assessment.ksh script 
######################################################

#set -xv

REXPE=$1
CONFS=$2
LJOBS=qstat

JOBS_LIST=` ${LJOBS} |  grep -c ${CONFS}`
if [ ${JOBS_LIST} = 0 ]
then
    sleep 60
    ./assessment.ksh ${REXPE} &
    exit
fi
sleep 300
./cron_jobs.ksh ${REXPE} ${CONFS} &
exit

