Ignore:
Timestamp:
12/20/10 10:43:22 (13 years ago)
Author:
mmaipsl
Message:

Clean last REBUILD directory to supress error after execution when re-submit the job.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/AA_clean_month

    r373 r403  
    22#************************************************************** 
    33# Author: Martial Mancip 
    4 # Contact: Martil.Mancip__at__ipsl.jussieu.fr 
     4# Contact: Martial.Mancip__at__ipsl.jussieu.fr 
    55# $Revision::                                          $ Revision of last commit 
    66# $Author::                                            $ Author of last commit 
     
    5757done 
    5858 
     59IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Post 
     60 
     61for option in ${config_Post[*]} ; do 
     62    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Post ${option} 
     63done 
     64 
    5965IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices" 
    6066IGCM_debug_PrintVariables 3 config_UserChoices_JobName 
     
    99105    CountListFiles=${#ListFiles[@]} 
    100106 
     107    # If exist, erase REBUILD DIR 
     108    PeriodDateBegin=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateBegin} ) 
     109    CountRebuildDir=0 
     110    if [ X${config_Post_RebuildFrequency} != X ] ; then 
     111        if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then 
     112            REBUILD_DIR=${R_SAVE}/TMP 
     113            set +A RebuildDir -- $( IGCM_sys_RshArchive "find ${REBUILD_DIR} -type d -name \"*${PeriodDateBegin}*\" " ) 
     114        else 
     115            REBUILD_DIR=${BIG_DIR}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 
     116            set +A RebuildDir -- $( find ${REBUILD_DIR} -type d -name  "*${PeriodDateBegin}*" ) 
     117        fi 
     118        CountRebuildDir=${#RebuildDir[@]} 
     119    fi 
     120 
    101121    IGCM_debug_Print 1 "Number of files to be erased : ${CountListFiles}." 
    102122    if [ ${CountListFiles} -gt 0 ] ; then  
     
    113133                echo "OK. It will be erased." 
    114134                IGCM_sys_RshArchive "find ${R_SAVE} -name \"*${PeriodDateEnd}*\" -exec rm -f '{}' \;" 
     135                echo "done." 
     136                ;; 
     137            non|NON|n|no|NO) 
     138                echo "Nothing to do !" 
     139                ;; 
     140        esac 
     141    fi 
     142 
     143    if [ ${CountRebuildDir} -gt 0 ] ; then  
     144        IGCM_debug_Print 1 "Number of REBUILD Dirs to be erased : ${CountRebuildDir}." 
     145        for Dir in ${RebuildDir[@]} ; do 
     146            IGCM_debug_Print 2 -e "\033[1;31m ${Dir}\033[m" 
     147        done 
     148 
     149        echo "\033[1;32mDo you REALLY want to erase all those Directories ?" 
     150        echo -n " Your answer (y/n) : \033[m" 
     151        read reponse 
     152        case ${reponse} in 
     153             
     154            oui|OUI|o|y|yes|YES) 
     155                echo "OK. It will be erased." 
     156                if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then 
     157                    IGCM_sys_RshArchive "find ${REBUILD_DIR} -type d -name \"*${PeriodDateBegin}*\" -exec rm -Rf '{}' \;" 
     158                else 
     159                    find ${REBUILD_DIR} -type d -name "*${PeriodDateBegin}*" -exec rm -Rf '{}' \; 
     160                fi 
    115161                echo "done." 
    116162                ;; 
Note: See TracChangeset for help on using the changeset viewer.