Ignore:
Timestamp:
02/04/13 16:39:38 (11 years ago)
Author:
labetoulle
Message:

Cosmetics :

  • Convert tabs into space for better lisibility with different editors.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/AA_clean_month

    r782 r785  
    8181 
    8282if [ ! -f ${SUBMIT_DIR}/run.card ]; then  
    83     echo "You seem NOT to have a run.card in this directory !!" 
    84     echo "This script will fail because it doesn't know what to do without run.card available." 
    85     exit 1 
     83  echo "You seem NOT to have a run.card in this directory !!" 
     84  echo "This script will fail because it doesn't know what to do without run.card available." 
     85  exit 1 
    8686else 
    87     #===================================# 
    88     #        Read updated run.card      # 
    89     #===================================# 
    90     IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState 
    91     IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration OldPrefix 
    92     IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin 
    93     IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd 
    94     IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod 
    95  
    96     PeriodDateEnd=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateEnd} ) 
    97     echo "Search files with ${PeriodDateEnd} in ${R_SAVE}" 
    98     set +A ListFiles -- $( IGCM_sys_RshArchive "find ${R_SAVE} -name \"*${PeriodDateEnd}*\" " ) 
    99     CountListFiles=${#ListFiles[@]} 
    100  
     87  #===================================# 
     88  #        Read updated run.card      # 
     89  #===================================# 
     90  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState 
     91  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration OldPrefix 
     92  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin 
     93  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd 
     94  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod 
     95 
     96  PeriodDateEnd=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateEnd} ) 
     97  echo "Search files with ${PeriodDateEnd} in ${R_SAVE}" 
     98  set +A ListFiles -- $( IGCM_sys_RshArchive "find ${R_SAVE} -name \"*${PeriodDateEnd}*\" " ) 
     99  CountListFiles=${#ListFiles[@]} 
     100 
     101  if [ X${Pack} = Xtrue ] ; then 
     102    echo "Search files with ${PeriodDateEnd} in ${R_BUFR}" 
     103    set +A ListFilesBuf -- $( IGCM_sys_RshMaster "find ${R_BUFR} -name \"*${PeriodDateEnd}*\" " ) 
     104    CountListFilesBuf=${#ListFilesBuf[@]} 
     105  else 
     106    CountListFilesBuf=0 
     107  fi 
     108 
     109  # If exist, erase REBUILD DIR 
     110  PeriodDateBegin=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateBegin} ) 
     111  CountRebuildDir=0 
     112  if [ X${config_Post_RebuildFrequency} != X ] ; then 
     113    if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then 
     114      set +A RebuildDir -- $( IGCM_sys_RshArchive "find ${REBUILD_DIR} -type d -name \"*${PeriodDateBegin}*\" " ) 
     115    else 
     116      set +A RebuildDir -- $( find ${REBUILD_DIR} -type d -name "*${PeriodDateBegin}*" ) 
     117    fi 
     118    CountRebuildDir=${#RebuildDir[@]} 
     119  fi 
     120 
     121  IGCM_debug_Print 1 "Number of files to be erased : ${CountListFiles}." 
     122  if ( [ ${CountListFiles} -gt 0 ] || [ ${CountListFilesBuf} -gt 0 ] ) ; then  
     123    for file in ${ListFiles[@]} ; do 
     124      IGCM_debug_Print 2 -e "\033[1;31m ${file}\033[m" 
     125    done 
    101126    if [ X${Pack} = Xtrue ] ; then 
    102       echo "Search files with ${PeriodDateEnd} in ${R_BUFR}" 
    103       set +A ListFilesBuf -- $( IGCM_sys_RshMaster "find ${R_BUFR} -name \"*${PeriodDateEnd}*\" " ) 
    104       CountListFilesBuf=${#ListFilesBuf[@]} 
    105     else 
    106       CountListFilesBuf=0 
     127      for file in ${ListFilesBuf[@]} ; do 
     128        IGCM_debug_Print 2 -e "\033[1;31m ${file}\033[m" 
     129      done 
    107130    fi 
    108  
    109     # If exist, erase REBUILD DIR 
    110     PeriodDateBegin=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateBegin} ) 
    111     CountRebuildDir=0 
    112     if [ X${config_Post_RebuildFrequency} != X ] ; then 
    113         if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then 
    114             set +A RebuildDir -- $( IGCM_sys_RshArchive "find ${REBUILD_DIR} -type d -name \"*${PeriodDateBegin}*\" " ) 
    115         else 
    116             set +A RebuildDir -- $( find ${REBUILD_DIR} -type d -name  "*${PeriodDateBegin}*" ) 
    117         fi 
    118         CountRebuildDir=${#RebuildDir[@]} 
    119     fi 
    120  
    121     IGCM_debug_Print 1 "Number of files to be erased : ${CountListFiles}." 
    122     if ( [ ${CountListFiles} -gt 0 ] || [ ${CountListFilesBuf} -gt 0 ] ) ; then  
    123         for file in ${ListFiles[@]} ; do 
    124             IGCM_debug_Print 2 -e "\033[1;31m ${file}\033[m" 
    125         done 
     131    echo -e "\033[1;32mDo you REALLY want to erase all those files ?" 
     132    echo -n -e " Your answer (y/n) : \033[m" 
     133    read reponse 
     134    case ${reponse} in 
     135 
     136      oui|OUI|o|y|yes|YES) 
     137        echo "OK. It will be erased." 
     138        IGCM_sys_RshArchive "find ${R_SAVE} -name \"*${PeriodDateEnd}*\" -exec rm -f '{}' \;" 
    126139        if [ X${Pack} = Xtrue ] ; then 
    127           for file in ${ListFilesBuf[@]} ; do 
    128             IGCM_debug_Print 2 -e "\033[1;31m ${file}\033[m" 
    129           done 
     140          IGCM_sys_RshMaster  "find ${R_BUFR} -name \"*${PeriodDateEnd}*\" -exec rm -f '{}' \;" 
    130141        fi 
    131         echo -e "\033[1;32mDo you REALLY want to erase all those files ?" 
    132         echo -n -e " Your answer (y/n) : \033[m" 
    133         read reponse 
    134         case ${reponse} in 
    135              
    136             oui|OUI|o|y|yes|YES) 
    137                 echo "OK. It will be erased." 
    138                 IGCM_sys_RshArchive "find ${R_SAVE} -name \"*${PeriodDateEnd}*\" -exec rm -f '{}' \;" 
    139                 if [ X${Pack} = Xtrue ] ; then 
    140                   IGCM_sys_RshMaster  "find ${R_BUFR} -name \"*${PeriodDateEnd}*\" -exec rm -f '{}' \;" 
    141                 fi 
    142                 echo "done." 
    143                 ;; 
    144             non|NON|n|no|NO) 
    145                 echo "Nothing to do !" 
    146                 ;; 
    147         esac 
    148     fi 
    149  
    150     if [ ${CountRebuildDir} -gt 0 ] ; then  
    151         IGCM_debug_Print 1 "Number of REBUILD Dirs to be erased : ${CountRebuildDir}." 
    152         for Dir in ${RebuildDir[@]} ; do 
    153             IGCM_debug_Print 2 -e "\033[1;31m ${Dir}\033[m" 
    154         done 
    155  
    156         echo -e "\033[1;32mDo you REALLY want to erase all those Directories ?" 
    157         echo -n -e " Your answer (y/n) : \033[m" 
    158         read reponse 
    159         case ${reponse} in 
    160              
    161             oui|OUI|o|y|yes|YES) 
    162                 echo "OK. It will be erased." 
    163                 if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then 
    164                     IGCM_sys_RshArchive "find ${REBUILD_DIR} -type d -name \"*${PeriodDateBegin}*\" -exec rm -Rf '{}' \;" 
    165                 else 
    166                     find ${REBUILD_DIR} -type d -name "*${PeriodDateBegin}*" -exec rm -Rf '{}' \; 
    167                 fi 
    168                 echo "done." 
    169                 ;; 
    170             non|NON|n|no|NO) 
    171                 echo "Nothing to do !" 
    172                 ;; 
    173         esac 
    174     fi 
    175      
    176     IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState 
    177     if ( [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then 
    178  
    179         echo -e "\033[1;32mNOW do you want to continue the simulation (Set PeriodState=OnQueue into run.card) ?" 
    180         echo -n -e " Your answer (y/n) : \033[m" 
    181         read reponse 
    182         case ${reponse} in 
    183              
    184             oui|OUI|o|y|yes|YES) 
    185                 echo "OK. Now you can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}." 
    186                 IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue" 
    187                 ;; 
    188             non|NON|n|no|NO) 
    189                 echo "Nothing to do !" 
    190                 ;; 
    191         esac 
    192     else 
    193         echo "You can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}." 
    194     fi 
    195  
    196     if ( [ X${run_Configuration_CumulPeriod} = X ] || [ X${run_Configuration_CumulPeriod} = X1 ] ); then 
    197       echo "CumulPeriod=1 so we erase run.card to start properly." 
    198       IGCM_sys_Rm ${SUBMIT_DIR}/run.card 
    199     fi 
     142        echo "done." 
     143        ;; 
     144      non|NON|n|no|NO) 
     145        echo "Nothing to do !" 
     146        ;; 
     147    esac 
     148  fi 
     149 
     150  if [ ${CountRebuildDir} -gt 0 ] ; then  
     151    IGCM_debug_Print 1 "Number of REBUILD Dirs to be erased : ${CountRebuildDir}." 
     152    for Dir in ${RebuildDir[@]} ; do 
     153      IGCM_debug_Print 2 -e "\033[1;31m ${Dir}\033[m" 
     154    done 
     155 
     156    echo -e "\033[1;32mDo you REALLY want to erase all those Directories ?" 
     157    echo -n -e " Your answer (y/n) : \033[m" 
     158    read reponse 
     159    case ${reponse} in 
     160 
     161      oui|OUI|o|y|yes|YES) 
     162        echo "OK. It will be erased." 
     163        if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then 
     164          IGCM_sys_RshArchive "find ${REBUILD_DIR} -type d -name \"*${PeriodDateBegin}*\" -exec rm -Rf '{}' \;" 
     165        else 
     166          find ${REBUILD_DIR} -type d -name "*${PeriodDateBegin}*" -exec rm -Rf '{}' \; 
     167        fi 
     168        echo "done." 
     169        ;; 
     170      non|NON|n|no|NO) 
     171        echo "Nothing to do !" 
     172        ;; 
     173    esac 
     174  fi 
     175 
     176  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState 
     177  if ( [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then 
     178 
     179    echo -e "\033[1;32mNOW do you want to continue the simulation (Set PeriodState=OnQueue into run.card) ?" 
     180    echo -n -e " Your answer (y/n) : \033[m" 
     181    read reponse 
     182    case ${reponse} in 
     183 
     184      oui|OUI|o|y|yes|YES) 
     185        echo "OK. Now you can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}." 
     186        IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue" 
     187        ;; 
     188      non|NON|n|no|NO) 
     189        echo "Nothing to do !" 
     190        ;; 
     191    esac 
     192  else 
     193    echo "You can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}." 
     194  fi 
     195 
     196  if ( [ X${run_Configuration_CumulPeriod} = X ] || [ X${run_Configuration_CumulPeriod} = X1 ] ); then 
     197    echo "CumulPeriod=1 so we erase run.card to start properly." 
     198    IGCM_sys_Rm ${SUBMIT_DIR}/run.card 
     199  fi 
    200200fi 
    201201exit 0 
Note: See TracChangeset for help on using the changeset viewer.