[387] | 1 | #!/bin/ksh |
---|
[342] | 2 | |
---|
| 3 | #************************************************************** |
---|
[350] | 4 | # Author: Martial Mancip |
---|
[373] | 5 | # Contact: Martial.Mancip__at__ipsl.jussieu.fr |
---|
| 6 | # $Revision:: $ Revision of last commit |
---|
| 7 | # $Author:: $ Author of last commit |
---|
| 8 | # $Date:: $ Date of last commit |
---|
[342] | 9 | # IPSL (2006) |
---|
| 10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
| 11 | # |
---|
| 12 | #************************************************************** |
---|
| 13 | |
---|
| 14 | # Change SpaceName/ExperimentName/JobName names and path for a simulation during the run. |
---|
| 15 | # !! Be careful that the job is suspended before using this script !! |
---|
| 16 | # You may call this script with those four variables already defined, or modify directly |
---|
| 17 | # default values under here : |
---|
| 18 | |
---|
| 19 | # New Name Space of this experience |
---|
| 20 | NEW_SpaceName=${NEW_SpaceName:=DEVT} |
---|
| 21 | |
---|
| 22 | # New Expericence class of the run |
---|
| 23 | NEW_ExperimentName=${NEW_ExperimentName:=NEWExperimentName} |
---|
| 24 | |
---|
| 25 | # New JobName of the run |
---|
| 26 | NEW_JobName=${NEW_JobName:=NEWJobName} |
---|
| 27 | |
---|
| 28 | SUBMIT_DIR=${SUBMIT_DIR:=my_path_to_my_SUBMIT_DIR} |
---|
| 29 | |
---|
| 30 | # verbosity |
---|
| 31 | Verbosity=3 |
---|
| 32 | |
---|
| 33 | ######################################################################## |
---|
| 34 | |
---|
| 35 | # Chemin vers MODIPSL |
---|
| 36 | MODIPSL=${MODIPSL:=::modipsl::} |
---|
| 37 | |
---|
| 38 | # Chemin vers libIGCM |
---|
| 39 | libIGCM=${libIGCM:=${MODIPSL}/libIGCM} |
---|
| 40 | # Attention : Ã changer si la machine de post-traitement n'est pas la frontale du serveur de calcul ! |
---|
| 41 | # voir précence de la variable MirrorlibIGCM dans votre couche systÚme. |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | DEBUG_sys=false |
---|
| 45 | DEBUG_debug=false |
---|
| 46 | |
---|
| 47 | ######################################################################## |
---|
| 48 | |
---|
| 49 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ; |
---|
| 50 | . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh #; IGCM_debug_Check |
---|
| 51 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh #; IGCM_card_Check |
---|
| 52 | . ${libIGCM}/libIGCM_date/libIGCM_date.ksh #; IGCM_date_Check |
---|
| 53 | . ${libIGCM}/libIGCM_config/libIGCM_config.ksh |
---|
| 54 | |
---|
| 55 | ######################################################################## |
---|
| 56 | # define local functions |
---|
| 57 | |
---|
| 58 | # Function to replace OLD JobName in file |
---|
| 59 | |
---|
| 60 | function REPLACE_sed |
---|
| 61 | { |
---|
| 62 | IGCM_debug_PushStack "REPLACE_sed" |
---|
[509] | 63 | typeset RET |
---|
[342] | 64 | |
---|
| 65 | FILEIN=${1} |
---|
| 66 | FILEOUT=$( basename ${FILEIN} ) |
---|
| 67 | |
---|
| 68 | sed -e "s&${R_SAVE}&${NEW_R_SAVE}&g" -e "s/${config_UserChoices_JobName}/${NEW_JobName}/g" \ |
---|
| 69 | ${1} > ${RUN_DIR_PATH}/${FILEOUT} |
---|
| 70 | RET=$? |
---|
| 71 | |
---|
| 72 | touch --reference=${1} ${RUN_DIR_PATH}/${FILEOUT} |
---|
| 73 | IGCM_sys_Mv ${RUN_DIR_PATH}/${FILEOUT} ${2} |
---|
| 74 | chmod --reference=${1} ${2}/${FILEOUT} |
---|
| 75 | |
---|
| 76 | IGCM_sys_Rm -f ${1} |
---|
| 77 | |
---|
| 78 | IGCM_debug_Print 3 "REPLACE_sed : ${1} ${2}" |
---|
| 79 | |
---|
| 80 | IGCM_debug_PopStack "REPLACE_sed" |
---|
| 81 | return $RET |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | function MOVE_and_RENAME_files |
---|
| 85 | { |
---|
| 86 | IGCM_debug_PushStack "MOVE_and_RENAME_files" |
---|
| 87 | |
---|
[509] | 88 | typeset VAR_files FILE_OUT file i RET |
---|
[342] | 89 | |
---|
| 90 | VAR_files=${1} |
---|
| 91 | eval VAR1=\${${VAR_files[0]}} |
---|
| 92 | |
---|
[509] | 93 | if [ X$( echo ${NEW_R_SAVE} | grep ${config_UserChoices_JobName} ) != X ]; then |
---|
| 94 | set +A FILE_OUT -- $( eval echo \${${VAR_files}[*]} | sed -e "s&${R_SAVE}&${NEW_R_SAVE}&g" ) |
---|
| 95 | ((i=0)) |
---|
| 96 | for file in ${FILE_OUT[@]} ; do |
---|
| 97 | FILE_OUT[$i]=$( dirname $file )/$( echo $( basename $file ) | sed -e "s/${config_UserChoices_JobName}/${NEW_JobName}/g" ) |
---|
| 98 | (( i = i + 1 )) |
---|
| 99 | done |
---|
| 100 | else |
---|
| 101 | set +A FILE_OUT -- $( eval echo \${${VAR_files}[*]} | sed -e "s&${R_SAVE}&${NEW_R_SAVE}&g" -e "s/${config_UserChoices_JobName}/${NEW_JobName}/g" ) |
---|
| 102 | fi |
---|
[342] | 103 | IGCM_debug_Print 3 "MOVE_and_RENAME_files all : ${VAR1}" |
---|
| 104 | IGCM_debug_Print 3 " to ${FILE_OUT}." |
---|
| 105 | |
---|
| 106 | (( ifile = 0 )) |
---|
| 107 | for file_o in ${FILE_OUT[@]} ; do |
---|
| 108 | eval IGCM_sys_Mv \${${VAR_files}[${ifile}]} ${file_o} |
---|
[509] | 109 | RET=$? |
---|
[342] | 110 | (( ifile = ifile + 1 )) |
---|
| 111 | done |
---|
| 112 | |
---|
| 113 | IGCM_debug_PopStack "MOVE_and_RENAME_files" |
---|
| 114 | return $RET |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | function MY_DODS_Cp |
---|
| 118 | { |
---|
| 119 | IGCM_debug_PushStack "MY_DODS_Cp" |
---|
| 120 | |
---|
[349] | 121 | typeset old_JobName old_R_DODS |
---|
[342] | 122 | IGCM_sys_Cd ${NEW_R_SAVE} |
---|
| 123 | old_JobName=${config_UserChoices_JobName} |
---|
[349] | 124 | old_R_DODS=${R_DODS} |
---|
| 125 | old_R_SAVE=${R_SAVE} |
---|
| 126 | |
---|
[342] | 127 | config_UserChoices_JobName=${NEW_JobName} |
---|
[349] | 128 | R_DODS=${NEW_R_DODS} |
---|
| 129 | R_SAVE=${NEW_R_SAVE} |
---|
| 130 | |
---|
[342] | 131 | IGCM_sys_Dods_Cp ${1} |
---|
| 132 | IGCM_debug_Print 3 "MY_DODS_Cp : ${config_UserChoices_JobName}/${1}" |
---|
| 133 | IGCM_sys_Cd ${RUN_DIR_PATH} |
---|
[349] | 134 | |
---|
[342] | 135 | config_UserChoices_JobName=${old_JobName} |
---|
[349] | 136 | R_DODS=${old_R_DODS} |
---|
| 137 | R_SAVE=${old_R_SAVE} |
---|
[342] | 138 | |
---|
| 139 | IGCM_debug_PopStack "MY_DODS_Cp" |
---|
| 140 | } |
---|
| 141 | |
---|
| 142 | function MY_DODS_Rm |
---|
| 143 | { |
---|
| 144 | IGCM_debug_PushStack "MY_DODS_Rm" |
---|
| 145 | DEBUG_debug=false |
---|
| 146 | |
---|
| 147 | IGCM_sys_Cd ${R_SAVE} |
---|
| 148 | IGCM_sys_Dods_Rm ${1} |
---|
| 149 | IGCM_debug_Print 3 "MY_DODS_Rm : ${config_UserChoices_JobName}/${1}" |
---|
| 150 | IGCM_sys_Cd ${RUN_DIR_PATH} |
---|
| 151 | |
---|
| 152 | IGCM_debug_PopStack "MY_DODS_Rm" |
---|
| 153 | } |
---|
| 154 | ######################################################################## |
---|
| 155 | |
---|
| 156 | if [ ! -d ${SUBMIT_DIR} ]; then |
---|
[349] | 157 | IGCM_debug_Print 1 "No ${SUBMIT_DIR}, we stop here" |
---|
[342] | 158 | exit 1 |
---|
| 159 | fi |
---|
| 160 | |
---|
| 161 | # We temporary change ${run_Configuration_PeriodState} to |
---|
| 162 | if [ -f ${SUBMIT_DIR}/run.card ] ; then |
---|
| 163 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState |
---|
| 164 | if ( [ ${run_Configuration_PeriodState} != "Start" ] && [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then |
---|
| 165 | old_run_Configuration_PeriodState=${run_Configuration_PeriodState} |
---|
| 166 | IGCM_debug_PrintVariables 2 old_run_Configuration_PeriodState |
---|
| 167 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue" |
---|
| 168 | fi |
---|
| 169 | fi |
---|
| 170 | |
---|
| 171 | IGCM_config_Initialize |
---|
| 172 | |
---|
| 173 | if [ -f ${SUBMIT_DIR}/run.card ] ; then |
---|
| 174 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration OldPrefix |
---|
| 175 | IGCM_debug_PrintVariables 2 run_Configuration_OldPrefix |
---|
| 176 | if [ X${old_run_Configuration_PeriodState} != X"Completed" ] ; then |
---|
| 177 | DateEnd=$( IGCM_date_ConvertFormatToGregorian $( echo ${run_Configuration_OldPrefix} | awk -F'_' '{print $2}' ) ) |
---|
| 178 | else |
---|
| 179 | DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) |
---|
| 180 | fi |
---|
| 181 | else |
---|
| 182 | DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) |
---|
| 183 | fi |
---|
| 184 | |
---|
| 185 | IGCM_debug_Print 1 "" |
---|
| 186 | IGCM_debug_Print 1 "DateEnd for MoveJob_Checker : " ${DateEnd} |
---|
| 187 | IGCM_date_GetYearMonth ${DateEnd} YearEnd MonthEnd |
---|
| 188 | IGCM_debug_Print 1 "YearEnd MonthEnd for TimeSeries_Checker : " ${YearEnd} ${MonthEnd} |
---|
| 189 | IGCM_debug_Print 1 "" |
---|
| 190 | |
---|
| 191 | #set -vx |
---|
| 192 | |
---|
| 193 | #==================================================== |
---|
| 194 | #DEFINE NEW_R_SAVE |
---|
| 195 | if [ X${config_UserChoices_SpaceName} != X ] ; then |
---|
| 196 | NEW_SAVE=${config_UserChoices_TagName}/${NEW_SpaceName} |
---|
| 197 | else |
---|
| 198 | NEW_SAVE=${config_UserChoices_TagName} |
---|
| 199 | fi |
---|
| 200 | if [ X${config_UserChoices_ExperimentName} != X ] ; then |
---|
| 201 | NEW_SAVE=${NEW_SAVE}/${NEW_ExperimentName} |
---|
| 202 | fi |
---|
| 203 | |
---|
| 204 | NEW_R_SAVE=${R_OUT}/${NEW_SAVE}/${NEW_JobName} |
---|
| 205 | |
---|
| 206 | IGCM_debug_Print 1 "Move ${R_SAVE} to ${NEW_R_SAVE}" |
---|
| 207 | if [ -d ${NEW_R_SAVE} ] ; then |
---|
[349] | 208 | IGCM_debug_Print 1 "ERROR : ${NEW_R_SAVE} directory already exist !" |
---|
| 209 | IGCM_debug_Print 1 "We won't try to We stop here." |
---|
[342] | 210 | exit 1 |
---|
| 211 | fi |
---|
| 212 | IGCM_sys_MkdirArchive ${NEW_R_SAVE} |
---|
| 213 | |
---|
[436] | 214 | # ------------------------------------------------------------------ |
---|
| 215 | # Test if all was right before proceeding further |
---|
| 216 | # ------------------------------------------------------------------ |
---|
| 217 | IGCM_debug_Verif_Exit_Post |
---|
| 218 | |
---|
[342] | 219 | #DEFINE NEW_R_DODS |
---|
[349] | 220 | NEW_R_DODS=${NEW_SAVE}/${NEW_JobName} |
---|
[342] | 221 | |
---|
| 222 | # Define NEW_REBUILD_DIR |
---|
| 223 | if [ -d ${REBUILD_DIR} ] ; then |
---|
| 224 | if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then |
---|
| 225 | NEW_REBUILD_DIR=${NEW_R_SAVE}/TMP |
---|
| 226 | IGCM_sys_MkdirArchive ${NEW_REBUILD_DIR} |
---|
| 227 | else |
---|
| 228 | NEW_REBUILD_DIR=${BIG_DIR}/${config_UserChoices_TagName}/${NEW_JobName} |
---|
| 229 | IGCM_sys_MkdirWork ${NEW_REBUILD_DIR} |
---|
| 230 | fi |
---|
| 231 | fi |
---|
| 232 | |
---|
| 233 | #==================================================== |
---|
| 234 | # SAVE LOCAL WORKING DIR |
---|
| 235 | IGCM_sys_Cd ${RUN_DIR_PATH} |
---|
| 236 | |
---|
| 237 | #==================================================== |
---|
| 238 | #Exe |
---|
| 239 | IGCM_debug_Print 1 "Move Exe" |
---|
| 240 | set +A listfiles -- $( find ${R_SAVE}/Exe -type f ) |
---|
| 241 | |
---|
| 242 | IGCM_sys_MkdirArchive ${NEW_R_SAVE}/Exe |
---|
| 243 | MOVE_and_RENAME_files "listfiles" |
---|
| 244 | |
---|
| 245 | #==================================================== |
---|
| 246 | #Out |
---|
| 247 | IGCM_debug_Print 1 "Move Out" |
---|
| 248 | OutinDir=${R_SAVE}/Out |
---|
| 249 | OutNEWDir=${NEW_R_SAVE}/Out |
---|
| 250 | IGCM_sys_MkdirArchive ${OutNEWDir} |
---|
| 251 | |
---|
| 252 | # Change JobName and copy run.card |
---|
[350] | 253 | if [ -f ${OutinDir}/run.card ] ; then |
---|
[509] | 254 | sed -e "s/OldPrefix=\ *${config_UserChoices_JobName}/OldPrefix= ${NEW_JobName}/g" \ |
---|
| 255 | ${OutinDir}/run.card > ${RUN_DIR_PATH}/run.card |
---|
| 256 | RET=$? |
---|
| 257 | if [ ${RET} = 0 ] ; then |
---|
| 258 | IGCM_sys_Mv -f ${RUN_DIR_PATH}/run.card ${OutNEWDir} |
---|
| 259 | IGCM_sys_Rm -f ${OutinDir}/run.card |
---|
| 260 | fi |
---|
[350] | 261 | fi |
---|
[342] | 262 | |
---|
| 263 | # Just copy historical run.card |
---|
| 264 | unset listfiles |
---|
| 265 | set +A listfiles -- $( find ${OutinDir} -type f -name "run.card\.[0-9]*\.[0-9]*" ) |
---|
[349] | 266 | if [ ${#listfiles[*]} -gt 0 ] ; then |
---|
| 267 | IGCM_sys_Cp ${listfiles[*]} ${OutNEWDir} |
---|
[509] | 268 | RET=$? |
---|
| 269 | if [ ${RET} = 0 ] ; then |
---|
| 270 | IGCM_sys_Rm -f ${listfiles[*]} |
---|
| 271 | fi |
---|
[349] | 272 | fi |
---|
[342] | 273 | |
---|
| 274 | # Move and Rename OLD Script_Output |
---|
| 275 | unset listfiles |
---|
| 276 | set +A listfiles -- $( find ${OutinDir} -type f -name "Script_Output_*\.[0-9]*\.[0-9]*" ) |
---|
| 277 | MOVE_and_RENAME_files "listfiles" |
---|
| 278 | |
---|
| 279 | # Move and Rename OLD Executable Output |
---|
| 280 | unset listfiles |
---|
| 281 | set +A listfiles -- $( find ${OutinDir} -type f -name "*_out_${config_Executable_Name}" ) |
---|
| 282 | MOVE_and_RENAME_files "listfiles" |
---|
[509] | 283 | unset listfiles |
---|
| 284 | set +A listfiles -- $( find ${OutinDir} -type f -name "*_out_execution" ) |
---|
| 285 | MOVE_and_RENAME_files "listfiles" |
---|
[342] | 286 | |
---|
| 287 | #==================================================== |
---|
| 288 | IGCM_debug_Print 1 "For components" |
---|
| 289 | IGCM_debug_Print 1 "==============" |
---|
| 290 | |
---|
| 291 | #==================================================== |
---|
| 292 | #Output |
---|
| 293 | # loop over components and frequencies |
---|
| 294 | IGCM_debug_Print 1 "Move Output" |
---|
| 295 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 296 | IGCM_debug_Print 2 "------------------" |
---|
| 297 | IGCM_debug_Print 2 "for component ${comp}" |
---|
| 298 | |
---|
| 299 | unset FREQDIR |
---|
| 300 | set +A FREQDIR -- $( find ${R_SAVE}/${comp}/Output -type d -not -name "*Output" ) |
---|
| 301 | |
---|
| 302 | IGCM_debug_Print 3 "List of WriteFrequencies : ${FREQDIR[*]}" |
---|
| 303 | |
---|
| 304 | for ThisfreqDir in ${FREQDIR[*]} ; do |
---|
| 305 | freq=$( basename ${ThisfreqDir} ) |
---|
| 306 | IGCM_debug_Print 2 "${freq}." |
---|
| 307 | |
---|
| 308 | NEW_freqDir=${NEW_R_SAVE}/${comp}/Output/${freq} |
---|
| 309 | IGCM_sys_MkdirArchive ${NEW_freqDir} |
---|
| 310 | |
---|
| 311 | unset listfiles |
---|
| 312 | set +A listfiles -- $( find ${ThisfreqDir} -type f ) |
---|
| 313 | |
---|
| 314 | MOVE_and_RENAME_files "listfiles" |
---|
| 315 | done |
---|
[350] | 316 | |
---|
| 317 | unset COMPFILES |
---|
| 318 | set +A COMPFILES -- $( find ${R_SAVE}/${comp}/Output -type f ) |
---|
| 319 | |
---|
| 320 | if [ ${#COMPFILES[*]} -gt 0 ] ; then |
---|
| 321 | IGCM_debug_Print 2 "simple Output FILES : ${COMPFILES[*]}." |
---|
| 322 | |
---|
| 323 | MOVE_and_RENAME_files "COMPFILES" |
---|
| 324 | fi |
---|
[342] | 325 | done |
---|
| 326 | |
---|
| 327 | #==================================================== |
---|
| 328 | #Restart |
---|
| 329 | # loop over components |
---|
| 330 | IGCM_debug_Print 1 "Move Restart" |
---|
| 331 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 332 | IGCM_debug_Print 2 "------------------" |
---|
| 333 | IGCM_debug_Print 2 "for component ${comp}" |
---|
| 334 | |
---|
| 335 | ThisRestDir=${R_SAVE}/${comp}/Restart |
---|
| 336 | NEW_RestDir=${NEW_R_SAVE}/${comp}/Restart |
---|
| 337 | IGCM_sys_MkdirArchive ${NEW_RestDir} |
---|
| 338 | |
---|
| 339 | unset listfiles |
---|
| 340 | set +A listfiles -- $( find ${ThisRestDir} -type f ) |
---|
| 341 | |
---|
| 342 | MOVE_and_RENAME_files "listfiles" |
---|
| 343 | done |
---|
| 344 | |
---|
| 345 | #==================================================== |
---|
| 346 | #DEBUG |
---|
| 347 | # Move and Rename OLD Executable Output |
---|
| 348 | # loop over components |
---|
| 349 | IGCM_debug_Print 1 "Move Debug" |
---|
| 350 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 351 | IGCM_debug_Print 2 "------------------" |
---|
| 352 | IGCM_debug_Print 2 "for component ${comp}" |
---|
| 353 | |
---|
| 354 | ThisDebugDir=${R_SAVE}/${comp}/Debug |
---|
| 355 | NEW_DebugDir=${NEW_R_SAVE}/${comp}/Debug |
---|
| 356 | IGCM_sys_MkdirArchive ${NEW_DebugDir} |
---|
| 357 | |
---|
| 358 | unset listfiles |
---|
| 359 | set +A listfiles -- $( find ${ThisDebugDir} -type f ) |
---|
| 360 | |
---|
| 361 | MOVE_and_RENAME_files "listfiles" |
---|
| 362 | done |
---|
| 363 | |
---|
| 364 | #==================================================== |
---|
| 365 | #POST |
---|
| 366 | # loop over components and frequencies |
---|
| 367 | IGCM_debug_Print 1 "Move Analyse" |
---|
| 368 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 369 | IGCM_debug_Print 2 "------------------" |
---|
| 370 | IGCM_debug_Print 2 "for component ${comp}" |
---|
| 371 | |
---|
| 372 | if [ -d ${R_SAVE}/${comp}/Analyse ] ; then |
---|
| 373 | unset TSDIR |
---|
| 374 | set +A TSDIR -- $( find ${R_SAVE}/${comp}/Analyse -name "TS_*" -type d ) |
---|
| 375 | |
---|
| 376 | for ThisTSDir in ${TSDIR[*]} ; do |
---|
| 377 | TS_Dir=$( basename ${ThisTSDir} ) |
---|
| 378 | IGCM_debug_Print 2 "${TS_Dir}." |
---|
| 379 | |
---|
| 380 | NEW_TSDir=${NEW_R_SAVE}/${comp}/Analyse/${TS_Dir} |
---|
| 381 | IGCM_sys_MkdirArchive ${NEW_TSDir} |
---|
| 382 | |
---|
| 383 | MY_DODS_Rm ${comp}/Analyse/${TS_Dir} |
---|
| 384 | |
---|
| 385 | unset listfiles |
---|
| 386 | set +A listfiles -- $( find ${ThisTSDir} -type f ) |
---|
| 387 | |
---|
| 388 | MOVE_and_RENAME_files "listfiles" |
---|
| 389 | |
---|
| 390 | MY_DODS_Cp ${comp}/Analyse/${TS_Dir} |
---|
| 391 | done |
---|
| 392 | |
---|
| 393 | ThisSEDir=${R_SAVE}/${comp}/Analyse/SE |
---|
| 394 | IGCM_sys_TestDirArchive ${ThisSEDir} |
---|
| 395 | if [ $? = 0 ] ; then |
---|
| 396 | IGCM_debug_Print 2 "SE." |
---|
| 397 | NEW_SEDir=${NEW_R_SAVE}/${comp}/Analyse/SE |
---|
| 398 | IGCM_sys_MkdirArchive ${NEW_SEDir} |
---|
| 399 | |
---|
| 400 | MY_DODS_Rm ${comp}/Analyse/SE |
---|
| 401 | |
---|
| 402 | unset listfiles |
---|
| 403 | set +A listfiles -- $( find ${ThisSEDir} -type f ) |
---|
| 404 | |
---|
| 405 | MOVE_and_RENAME_files "listfiles" |
---|
| 406 | |
---|
| 407 | MY_DODS_Cp ${comp}/Analyse/SE |
---|
| 408 | fi |
---|
[349] | 409 | |
---|
| 410 | MY_DODS_Rm ${comp}/Analyse |
---|
| 411 | MY_DODS_Rm ${comp} |
---|
[342] | 412 | else |
---|
| 413 | IGCM_debug_Print 2 "nothing to do without Analyse." |
---|
| 414 | fi |
---|
| 415 | |
---|
| 416 | done |
---|
| 417 | |
---|
| 418 | #==================================================== |
---|
| 419 | #GRAPHS |
---|
| 420 | IGCM_debug_Print 1 "Move ATLAS" |
---|
| 421 | R_ATLAS=ATLAS |
---|
| 422 | IGCM_sys_TestDirArchive ${R_SAVE}/${R_ATLAS} |
---|
| 423 | if [ $? = 0 ] ; then |
---|
| 424 | # REPLACE_sed ${NEW_R_SAVE}/${R_ATLAS}/*/*/index.html ${NEW_R_SAVE}/${R_ATLAS} |
---|
| 425 | |
---|
| 426 | MY_DODS_Rm ${R_ATLAS} |
---|
| 427 | |
---|
[346] | 428 | IGCM_sys_Mv ${R_SAVE}/${R_ATLAS} ${NEW_R_SAVE}/${R_ATLAS} |
---|
| 429 | |
---|
[342] | 430 | MY_DODS_Cp ${R_ATLAS} |
---|
| 431 | fi |
---|
| 432 | |
---|
| 433 | IGCM_debug_Print 1 "Move MONITORING" |
---|
| 434 | R_MONITORING=MONITORING |
---|
| 435 | IGCM_sys_TestDirArchive ${R_SAVE}/${R_MONITORING} |
---|
| 436 | if [ $? = 0 ] ; then |
---|
| 437 | IGCM_sys_MkdirArchive ${NEW_R_SAVE}/${R_MONITORING} |
---|
| 438 | REPLACE_sed ${R_SAVE}/${R_MONITORING}/index.html ${NEW_R_SAVE}/${R_MONITORING} |
---|
[509] | 439 | sed -e "s/OldPrefix=\ *${config_UserChoices_JobName}/OldPrefix= ${NEW_JobName}/g" \ |
---|
| 440 | ${R_SAVE}/${R_MONITORING}/run.card > ${RUN_DIR_PATH}/run.card |
---|
| 441 | IGCM_sys_Mv -f ${RUN_DIR_PATH}/run.card ${NEW_R_SAVE}/${R_MONITORING} |
---|
| 442 | RET=$? |
---|
| 443 | if [ ${RET} = 0 ] ; then |
---|
| 444 | IGCM_sys_Rm -f ${R_SAVE}/${R_MONITORING}/run.card |
---|
| 445 | fi |
---|
[346] | 446 | REPLACE_sed ${R_SAVE}/${R_MONITORING}/config.card ${NEW_R_SAVE}/${R_MONITORING} |
---|
| 447 | IGCM_sys_Cp -rp ${R_SAVE}/${R_MONITORING} ${NEW_R_SAVE} |
---|
[342] | 448 | |
---|
| 449 | MY_DODS_Rm ${R_MONITORING} |
---|
[346] | 450 | IGCM_sys_Rm -rf ${R_SAVE}/${R_MONITORING} |
---|
[342] | 451 | |
---|
| 452 | MY_DODS_Cp ${R_MONITORING} |
---|
| 453 | fi |
---|
| 454 | |
---|
| 455 | |
---|
| 456 | #==================================================== |
---|
| 457 | #REBUILD |
---|
| 458 | |
---|
| 459 | if [ -d ${REBUILD_DIR} ] ; then |
---|
| 460 | |
---|
| 461 | IGCM_debug_Print 1 "Move REBUILD" |
---|
[350] | 462 | set +A LISTREBUILDS -- $( find ${REBUILD_DIR} -type d -not -name "*${config_UserChoices_JobName}" -a -not -name "*TMP" ) |
---|
[342] | 463 | |
---|
[350] | 464 | for ThisREBDir in ${LISTREBUILDS[*]} ; do |
---|
| 465 | rebdir=$( basename ${ThisREBDir} ) |
---|
[342] | 466 | IGCM_debug_Print 2 "${rebdir}." |
---|
| 467 | if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then |
---|
| 468 | IGCM_sys_MkdirArchive ${NEW_REBUILD_DIR}/${rebdir} |
---|
| 469 | else |
---|
| 470 | IGCM_sys_MkdirWork ${NEW_REBUILD_DIR}/${rebdir} |
---|
| 471 | fi |
---|
| 472 | REPLACE_sed ${REBUILD_DIR}/${rebdir}/rebuild.ksh ${NEW_REBUILD_DIR}/${rebdir} |
---|
[350] | 473 | IGCM_sys_Mv -f ${REBUILD_DIR}/${rebdir}/* ${NEW_REBUILD_DIR}/${rebdir}/ |
---|
[342] | 474 | done |
---|
| 475 | fi |
---|
| 476 | |
---|
| 477 | #==================================================== |
---|
| 478 | #List OLD R_SAVE and Ask for erase it ! |
---|
| 479 | |
---|
| 480 | IGCM_debug_Print 1 "ls of SAVE DIR :" |
---|
| 481 | ls --color -lR ${R_SAVE} |
---|
| 482 | |
---|
| 483 | echo "\033[1;31mPlease verify that ALL OLD DIRECTORY LISTED IS COMPLETLY EMPTY !" |
---|
| 484 | echo "\033[1;32mIf It is NOT EMPTY, you can TRY AGAIN this script." |
---|
| 485 | echo "\033[1;31mDo you REALLY want to erase all this directory ?" |
---|
| 486 | echo -n " Your answer (y/n) : \033[m" |
---|
[346] | 487 | if [ X${reponse} = X ] ; then |
---|
| 488 | read reponse |
---|
| 489 | fi |
---|
[342] | 490 | case ${reponse} in |
---|
| 491 | |
---|
| 492 | oui|OUI|o|y|yes|YES) |
---|
| 493 | echo "OK. It will be erased." |
---|
| 494 | IGCM_sys_Rm -Rf ${R_SAVE} |
---|
| 495 | echo "done." |
---|
| 496 | ;; |
---|
| 497 | non|NON|n|no|NO) |
---|
| 498 | echo "Nothing to do !" |
---|
| 499 | ;; |
---|
| 500 | esac |
---|
| 501 | |
---|
| 502 | |
---|
| 503 | ############################################################################################################# |
---|
| 504 | # Edit config.card, run.card and Job_${NewJobName} |
---|
| 505 | |
---|
| 506 | IGCM_debug_Print 1 "edit config.card" |
---|
| 507 | if [ X${config_UserChoices_SpaceName} != X ] ; then |
---|
| 508 | IGCM_card_WriteOption ${SUBMIT_DIR}/config.card UserChoices SpaceName ${NEW_SpaceName} |
---|
| 509 | fi |
---|
| 510 | if [ X${config_UserChoices_ExperimentName} != X ] ; then |
---|
| 511 | IGCM_card_WriteOption ${SUBMIT_DIR}/config.card UserChoices ExperimentName ${NEW_ExperimentName} |
---|
| 512 | fi |
---|
| 513 | IGCM_card_WriteOption ${SUBMIT_DIR}/config.card UserChoices JobName ${NEW_JobName} |
---|
| 514 | |
---|
| 515 | if [ -f ${SUBMIT_DIR}/run.card ] ; then |
---|
| 516 | IGCM_debug_Print 1 "edit run.card" |
---|
[509] | 517 | sed -e "s/OldPrefix=\ *${config_UserChoices_JobName}/OldPrefix= ${NEW_JobName}/g" \ |
---|
[342] | 518 | ${SUBMIT_DIR}/run.card > ${RUN_DIR_PATH}/run.card |
---|
| 519 | IGCM_sys_Mv -f ${RUN_DIR_PATH}/run.card ${SUBMIT_DIR}/run.card |
---|
| 520 | |
---|
| 521 | if [ X${old_run_Configuration_PeriodState} != X ] ; then |
---|
| 522 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState ${old_run_Configuration_PeriodState} |
---|
| 523 | fi |
---|
| 524 | fi |
---|
| 525 | |
---|
| 526 | if [ -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ] ; then |
---|
| 527 | IGCM_debug_Print 1 "edit Job_${NEW_JobName}" |
---|
| 528 | sed -e "s&${R_SAVE}&${NEW_R_SAVE}&g" -e "s/${config_UserChoices_JobName}/${NEW_JobName}/g" \ |
---|
| 529 | ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} > ${SUBMIT_DIR}/Job_${NEW_JobName} |
---|
| 530 | chmod --reference=${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ${SUBMIT_DIR}/Job_${NEW_JobName} |
---|
| 531 | ls -la ${SUBMIT_DIR}/Job_${NEW_JobName} |
---|
| 532 | fi |
---|