#!/bin/bash ###################### ## TITANE CEA ## ###################### #MSUB -r ipsl_pack # Nom du job #MSUB -eo #MSUB -n 1 # Reservation du processus #MSUB -T 86400 # Limite de temps elapsed du job #MSUB -p gen2211 #MSUB -q mono # ex : ./launch_ipsl_enlarge.sh # gpdebug : pour option -f restartExecFromZero=0 while [ $# -gt 0 ] do echo "boucle sur les arguments du script ..." echo "@=$@" case $1 in -f) restartExecFromZero=1 echo "force restart from the beginning ..." ;; esac shift done export restartExecFromZero=${restartExecFromZero} # gpdebug : end export JOB_DIR=${LS_SUBCWD:-${PWD}} export EXE_DIR=${JOB_DIR} export INPUT_DMF_DATA=/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable export OUTPUT_STORE=${SCRATCHDIR}/PSEUDO_DMNFS_STORE export OUTPUT_WORK=${SCRATCHDIR}/PSEUDO_DMNFS_WORK SCRIPT_NAME=$(basename ${0} ) export IGCM_DEM=${SCRATCHDIR}/IGCM_DEM export IGCM_TMP=${SCRATCHDIR}/IGCM_DEM/tmp export clean_tmp=${clean_tmp:-yes} export DEM_LOG=${JOB_DIR}/dem_${LSB_JOBID:-${$}}.log export LOG_LEV=2 export config_card=${IGCM_DEM}/config_card.liste ############## gpdebug : Pour gestion des erreurs ######################################### # Execute la function errorReceive() si reception d'un signal TERM trap 'DEM_errorReceive' TERM # liste des processus à détruire en cas d'erreur bloquante export listPID=$$ # fichier pour la transmission des messages d'erreur d'un fils au prog principal export errorMsgFile="${PWD}/errorMsg.txt" ############## gpdebug : fin ############################################################## source ${EXE_DIR}/DEM_utilities.sh DEM_log -0 "Demarrage de ${SCRIPT_NAME}" check_nco_version # gpdebug : verification de la version de nco ####################### # gpdebug : si l'option -f est activee, on detruit tous les fichiers status if [ "x$restartExecFromZero" == "x1" ] then echo "Deleting all status files ..." for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) do PATH_SIMU=$( dirname $CONFIG ) ListStatFileInSimu=`find $PATH_SIMU -type f -name "*status" ` if [ "x$ListStatFileInSimu" != "x" ] then for file in $ListStatFileInSimu do if [ -e $file ] then rm -f $file fi done fi done echo "Deletion done." fi # gpdebug : end for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do DEM_state=$( DEM_read_state ${IGCM_DEM}/config_card.liste ${CONFIG} ) if [[ "${DEM_state}" != "WriteListTarDone" ]] ; then DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} PackRunning export PATH_SIMU=$( dirname $CONFIG ) ${EXE_DIR}/enlarge_my_files.sh ${INPUT_DMF_DATA} ${OUTPUT_STORE} ${OUTPUT_WORK} DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} PackDone else DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} TarRunning export PATH_SIMU=$( dirname $CONFIG ) ${EXE_DIR}/tar_full_simu.sh ${INPUT_DMF_DATA} ${OUTPUT_STORE} ${CONFIG} DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} TarDone fi done DEM_log -0 "Fin de ${SCRIPT_NAME}"