[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" |
---|
| 63 | |
---|
| 64 | FILEIN=${1} |
---|
| 65 | FILEOUT=$( basename ${FILEIN} ) |
---|
| 66 | |
---|
| 67 | sed -e "s&${R_SAVE}&${NEW_R_SAVE}&g" -e "s/${config_UserChoices_JobName}/${NEW_JobName}/g" \ |
---|
| 68 | ${1} > ${RUN_DIR_PATH}/${FILEOUT} |
---|
| 69 | RET=$? |
---|
| 70 | |
---|
| 71 | touch --reference=${1} ${RUN_DIR_PATH}/${FILEOUT} |
---|
| 72 | IGCM_sys_Mv ${RUN_DIR_PATH}/${FILEOUT} ${2} |
---|
| 73 | chmod --reference=${1} ${2}/${FILEOUT} |
---|
| 74 | |
---|
| 75 | IGCM_sys_Rm -f ${1} |
---|
| 76 | |
---|
| 77 | IGCM_debug_Print 3 "REPLACE_sed : ${1} ${2}" |
---|
| 78 | |
---|
| 79 | IGCM_debug_PopStack "REPLACE_sed" |
---|
| 80 | return $RET |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | function MOVE_and_RENAME_files |
---|
| 84 | { |
---|
| 85 | IGCM_debug_PushStack "MOVE_and_RENAME_files" |
---|
| 86 | |
---|
| 87 | typeset VAR_files FILE_OUT |
---|
| 88 | |
---|
| 89 | VAR_files=${1} |
---|
| 90 | eval VAR1=\${${VAR_files[0]}} |
---|
| 91 | |
---|
| 92 | 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" ) |
---|
| 93 | IGCM_debug_Print 3 "MOVE_and_RENAME_files all : ${VAR1}" |
---|
| 94 | IGCM_debug_Print 3 " to ${FILE_OUT}." |
---|
| 95 | |
---|
| 96 | (( ifile = 0 )) |
---|
| 97 | for file_o in ${FILE_OUT[@]} ; do |
---|
| 98 | eval IGCM_sys_Mv \${${VAR_files}[${ifile}]} ${file_o} |
---|
| 99 | (( ifile = ifile + 1 )) |
---|
| 100 | done |
---|
| 101 | RET=$? |
---|
| 102 | |
---|
| 103 | IGCM_debug_PopStack "MOVE_and_RENAME_files" |
---|
| 104 | return $RET |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | function MY_DODS_Cp |
---|
| 108 | { |
---|
| 109 | IGCM_debug_PushStack "MY_DODS_Cp" |
---|
| 110 | |
---|
[349] | 111 | typeset old_JobName old_R_DODS |
---|
[342] | 112 | IGCM_sys_Cd ${NEW_R_SAVE} |
---|
| 113 | old_JobName=${config_UserChoices_JobName} |
---|
[349] | 114 | old_R_DODS=${R_DODS} |
---|
| 115 | old_R_SAVE=${R_SAVE} |
---|
| 116 | |
---|
[342] | 117 | config_UserChoices_JobName=${NEW_JobName} |
---|
[349] | 118 | R_DODS=${NEW_R_DODS} |
---|
| 119 | R_SAVE=${NEW_R_SAVE} |
---|
| 120 | |
---|
[342] | 121 | IGCM_sys_Dods_Cp ${1} |
---|
| 122 | IGCM_debug_Print 3 "MY_DODS_Cp : ${config_UserChoices_JobName}/${1}" |
---|
| 123 | IGCM_sys_Cd ${RUN_DIR_PATH} |
---|
[349] | 124 | |
---|
[342] | 125 | config_UserChoices_JobName=${old_JobName} |
---|
[349] | 126 | R_DODS=${old_R_DODS} |
---|
| 127 | R_SAVE=${old_R_SAVE} |
---|
[342] | 128 | |
---|
| 129 | IGCM_debug_PopStack "MY_DODS_Cp" |
---|
| 130 | } |
---|
| 131 | |
---|
| 132 | function MY_DODS_Rm |
---|
| 133 | { |
---|
| 134 | IGCM_debug_PushStack "MY_DODS_Rm" |
---|
| 135 | DEBUG_debug=false |
---|
| 136 | |
---|
| 137 | IGCM_sys_Cd ${R_SAVE} |
---|
| 138 | IGCM_sys_Dods_Rm ${1} |
---|
| 139 | IGCM_debug_Print 3 "MY_DODS_Rm : ${config_UserChoices_JobName}/${1}" |
---|
| 140 | IGCM_sys_Cd ${RUN_DIR_PATH} |
---|
| 141 | |
---|
| 142 | IGCM_debug_PopStack "MY_DODS_Rm" |
---|
| 143 | } |
---|
| 144 | ######################################################################## |
---|
| 145 | |
---|
| 146 | if [ ! -d ${SUBMIT_DIR} ]; then |
---|
[349] | 147 | IGCM_debug_Print 1 "No ${SUBMIT_DIR}, we stop here" |
---|
[342] | 148 | exit 1 |
---|
| 149 | fi |
---|
| 150 | |
---|
| 151 | # We temporary change ${run_Configuration_PeriodState} to |
---|
| 152 | if [ -f ${SUBMIT_DIR}/run.card ] ; then |
---|
| 153 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState |
---|
| 154 | if ( [ ${run_Configuration_PeriodState} != "Start" ] && [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then |
---|
| 155 | old_run_Configuration_PeriodState=${run_Configuration_PeriodState} |
---|
| 156 | IGCM_debug_PrintVariables 2 old_run_Configuration_PeriodState |
---|
| 157 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue" |
---|
| 158 | fi |
---|
| 159 | fi |
---|
| 160 | |
---|
| 161 | IGCM_config_Initialize |
---|
| 162 | |
---|
| 163 | if [ -f ${SUBMIT_DIR}/run.card ] ; then |
---|
| 164 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration OldPrefix |
---|
| 165 | IGCM_debug_PrintVariables 2 run_Configuration_OldPrefix |
---|
| 166 | if [ X${old_run_Configuration_PeriodState} != X"Completed" ] ; then |
---|
| 167 | DateEnd=$( IGCM_date_ConvertFormatToGregorian $( echo ${run_Configuration_OldPrefix} | awk -F'_' '{print $2}' ) ) |
---|
| 168 | else |
---|
| 169 | DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) |
---|
| 170 | fi |
---|
| 171 | else |
---|
| 172 | DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) |
---|
| 173 | fi |
---|
| 174 | |
---|
| 175 | IGCM_debug_Print 1 "" |
---|
| 176 | IGCM_debug_Print 1 "DateEnd for MoveJob_Checker : " ${DateEnd} |
---|
| 177 | IGCM_date_GetYearMonth ${DateEnd} YearEnd MonthEnd |
---|
| 178 | IGCM_debug_Print 1 "YearEnd MonthEnd for TimeSeries_Checker : " ${YearEnd} ${MonthEnd} |
---|
| 179 | IGCM_debug_Print 1 "" |
---|
| 180 | |
---|
| 181 | #set -vx |
---|
| 182 | |
---|
| 183 | #==================================================== |
---|
| 184 | #DEFINE NEW_R_SAVE |
---|
| 185 | if [ X${config_UserChoices_SpaceName} != X ] ; then |
---|
| 186 | NEW_SAVE=${config_UserChoices_TagName}/${NEW_SpaceName} |
---|
| 187 | else |
---|
| 188 | NEW_SAVE=${config_UserChoices_TagName} |
---|
| 189 | fi |
---|
| 190 | if [ X${config_UserChoices_ExperimentName} != X ] ; then |
---|
| 191 | NEW_SAVE=${NEW_SAVE}/${NEW_ExperimentName} |
---|
| 192 | fi |
---|
| 193 | |
---|
| 194 | NEW_R_SAVE=${R_OUT}/${NEW_SAVE}/${NEW_JobName} |
---|
| 195 | |
---|
| 196 | IGCM_debug_Print 1 "Move ${R_SAVE} to ${NEW_R_SAVE}" |
---|
| 197 | if [ -d ${NEW_R_SAVE} ] ; then |
---|
[349] | 198 | IGCM_debug_Print 1 "ERROR : ${NEW_R_SAVE} directory already exist !" |
---|
| 199 | IGCM_debug_Print 1 "We won't try to We stop here." |
---|
[342] | 200 | exit 1 |
---|
| 201 | fi |
---|
| 202 | IGCM_sys_MkdirArchive ${NEW_R_SAVE} |
---|
| 203 | |
---|
[436] | 204 | # ------------------------------------------------------------------ |
---|
| 205 | # Test if all was right before proceeding further |
---|
| 206 | # ------------------------------------------------------------------ |
---|
| 207 | IGCM_debug_Verif_Exit_Post |
---|
| 208 | |
---|
[342] | 209 | #DEFINE NEW_R_DODS |
---|
[349] | 210 | NEW_R_DODS=${NEW_SAVE}/${NEW_JobName} |
---|
[342] | 211 | |
---|
| 212 | # Define NEW_REBUILD_DIR |
---|
| 213 | if [ -d ${REBUILD_DIR} ] ; then |
---|
| 214 | if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then |
---|
| 215 | NEW_REBUILD_DIR=${NEW_R_SAVE}/TMP |
---|
| 216 | IGCM_sys_MkdirArchive ${NEW_REBUILD_DIR} |
---|
| 217 | else |
---|
| 218 | NEW_REBUILD_DIR=${BIG_DIR}/${config_UserChoices_TagName}/${NEW_JobName} |
---|
| 219 | IGCM_sys_MkdirWork ${NEW_REBUILD_DIR} |
---|
| 220 | fi |
---|
| 221 | fi |
---|
| 222 | |
---|
| 223 | #==================================================== |
---|
| 224 | # SAVE LOCAL WORKING DIR |
---|
| 225 | IGCM_sys_Cd ${RUN_DIR_PATH} |
---|
| 226 | |
---|
| 227 | #==================================================== |
---|
| 228 | #Exe |
---|
| 229 | IGCM_debug_Print 1 "Move Exe" |
---|
| 230 | set +A listfiles -- $( find ${R_SAVE}/Exe -type f ) |
---|
| 231 | |
---|
| 232 | IGCM_sys_MkdirArchive ${NEW_R_SAVE}/Exe |
---|
| 233 | MOVE_and_RENAME_files "listfiles" |
---|
| 234 | |
---|
| 235 | #==================================================== |
---|
| 236 | #Out |
---|
| 237 | IGCM_debug_Print 1 "Move Out" |
---|
| 238 | OutinDir=${R_SAVE}/Out |
---|
| 239 | OutNEWDir=${NEW_R_SAVE}/Out |
---|
| 240 | IGCM_sys_MkdirArchive ${OutNEWDir} |
---|
| 241 | |
---|
| 242 | # Change JobName and copy run.card |
---|
[350] | 243 | if [ -f ${OutinDir}/run.card ] ; then |
---|
| 244 | REPLACE_sed ${OutinDir}/run.card ${OutNEWDir} |
---|
| 245 | fi |
---|
[342] | 246 | |
---|
| 247 | # Just copy historical run.card |
---|
| 248 | unset listfiles |
---|
| 249 | set +A listfiles -- $( find ${OutinDir} -type f -name "run.card\.[0-9]*\.[0-9]*" ) |
---|
[349] | 250 | if [ ${#listfiles[*]} -gt 0 ] ; then |
---|
| 251 | IGCM_sys_Cp ${listfiles[*]} ${OutNEWDir} |
---|
| 252 | IGCM_sys_Rm -f ${listfiles[*]} |
---|
| 253 | fi |
---|
[342] | 254 | |
---|
| 255 | # Move and Rename OLD Script_Output |
---|
| 256 | unset listfiles |
---|
| 257 | set +A listfiles -- $( find ${OutinDir} -type f -name "Script_Output_*\.[0-9]*\.[0-9]*" ) |
---|
| 258 | MOVE_and_RENAME_files "listfiles" |
---|
| 259 | |
---|
| 260 | # Move and Rename OLD Executable Output |
---|
| 261 | unset listfiles |
---|
| 262 | set +A listfiles -- $( find ${OutinDir} -type f -name "*_out_${config_Executable_Name}" ) |
---|
| 263 | MOVE_and_RENAME_files "listfiles" |
---|
| 264 | |
---|
| 265 | #==================================================== |
---|
| 266 | IGCM_debug_Print 1 "For components" |
---|
| 267 | IGCM_debug_Print 1 "==============" |
---|
| 268 | |
---|
| 269 | #==================================================== |
---|
| 270 | #Output |
---|
| 271 | # loop over components and frequencies |
---|
| 272 | IGCM_debug_Print 1 "Move Output" |
---|
| 273 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 274 | IGCM_debug_Print 2 "------------------" |
---|
| 275 | IGCM_debug_Print 2 "for component ${comp}" |
---|
| 276 | |
---|
| 277 | unset FREQDIR |
---|
| 278 | set +A FREQDIR -- $( find ${R_SAVE}/${comp}/Output -type d -not -name "*Output" ) |
---|
| 279 | |
---|
| 280 | IGCM_debug_Print 3 "List of WriteFrequencies : ${FREQDIR[*]}" |
---|
| 281 | |
---|
| 282 | for ThisfreqDir in ${FREQDIR[*]} ; do |
---|
| 283 | freq=$( basename ${ThisfreqDir} ) |
---|
| 284 | IGCM_debug_Print 2 "${freq}." |
---|
| 285 | |
---|
| 286 | NEW_freqDir=${NEW_R_SAVE}/${comp}/Output/${freq} |
---|
| 287 | IGCM_sys_MkdirArchive ${NEW_freqDir} |
---|
| 288 | |
---|
| 289 | unset listfiles |
---|
| 290 | set +A listfiles -- $( find ${ThisfreqDir} -type f ) |
---|
| 291 | |
---|
| 292 | MOVE_and_RENAME_files "listfiles" |
---|
| 293 | done |
---|
[350] | 294 | |
---|
| 295 | unset COMPFILES |
---|
| 296 | set +A COMPFILES -- $( find ${R_SAVE}/${comp}/Output -type f ) |
---|
| 297 | |
---|
| 298 | if [ ${#COMPFILES[*]} -gt 0 ] ; then |
---|
| 299 | IGCM_debug_Print 2 "simple Output FILES : ${COMPFILES[*]}." |
---|
| 300 | |
---|
| 301 | MOVE_and_RENAME_files "COMPFILES" |
---|
| 302 | fi |
---|
[342] | 303 | done |
---|
| 304 | |
---|
| 305 | #==================================================== |
---|
| 306 | #Restart |
---|
| 307 | # loop over components |
---|
| 308 | IGCM_debug_Print 1 "Move Restart" |
---|
| 309 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 310 | IGCM_debug_Print 2 "------------------" |
---|
| 311 | IGCM_debug_Print 2 "for component ${comp}" |
---|
| 312 | |
---|
| 313 | ThisRestDir=${R_SAVE}/${comp}/Restart |
---|
| 314 | NEW_RestDir=${NEW_R_SAVE}/${comp}/Restart |
---|
| 315 | IGCM_sys_MkdirArchive ${NEW_RestDir} |
---|
| 316 | |
---|
| 317 | unset listfiles |
---|
| 318 | set +A listfiles -- $( find ${ThisRestDir} -type f ) |
---|
| 319 | |
---|
| 320 | MOVE_and_RENAME_files "listfiles" |
---|
| 321 | done |
---|
| 322 | |
---|
| 323 | #==================================================== |
---|
| 324 | #DEBUG |
---|
| 325 | # Move and Rename OLD Executable Output |
---|
| 326 | # loop over components |
---|
| 327 | IGCM_debug_Print 1 "Move Debug" |
---|
| 328 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 329 | IGCM_debug_Print 2 "------------------" |
---|
| 330 | IGCM_debug_Print 2 "for component ${comp}" |
---|
| 331 | |
---|
| 332 | ThisDebugDir=${R_SAVE}/${comp}/Debug |
---|
| 333 | NEW_DebugDir=${NEW_R_SAVE}/${comp}/Debug |
---|
| 334 | IGCM_sys_MkdirArchive ${NEW_DebugDir} |
---|
| 335 | |
---|
| 336 | unset listfiles |
---|
| 337 | set +A listfiles -- $( find ${ThisDebugDir} -type f ) |
---|
| 338 | |
---|
| 339 | MOVE_and_RENAME_files "listfiles" |
---|
| 340 | done |
---|
| 341 | |
---|
| 342 | #==================================================== |
---|
| 343 | #POST |
---|
| 344 | # loop over components and frequencies |
---|
| 345 | IGCM_debug_Print 1 "Move Analyse" |
---|
| 346 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 347 | IGCM_debug_Print 2 "------------------" |
---|
| 348 | IGCM_debug_Print 2 "for component ${comp}" |
---|
| 349 | |
---|
| 350 | if [ -d ${R_SAVE}/${comp}/Analyse ] ; then |
---|
| 351 | unset TSDIR |
---|
| 352 | set +A TSDIR -- $( find ${R_SAVE}/${comp}/Analyse -name "TS_*" -type d ) |
---|
| 353 | |
---|
| 354 | for ThisTSDir in ${TSDIR[*]} ; do |
---|
| 355 | TS_Dir=$( basename ${ThisTSDir} ) |
---|
| 356 | IGCM_debug_Print 2 "${TS_Dir}." |
---|
| 357 | |
---|
| 358 | NEW_TSDir=${NEW_R_SAVE}/${comp}/Analyse/${TS_Dir} |
---|
| 359 | IGCM_sys_MkdirArchive ${NEW_TSDir} |
---|
| 360 | |
---|
| 361 | MY_DODS_Rm ${comp}/Analyse/${TS_Dir} |
---|
| 362 | |
---|
| 363 | unset listfiles |
---|
| 364 | set +A listfiles -- $( find ${ThisTSDir} -type f ) |
---|
| 365 | |
---|
| 366 | MOVE_and_RENAME_files "listfiles" |
---|
| 367 | |
---|
| 368 | MY_DODS_Cp ${comp}/Analyse/${TS_Dir} |
---|
| 369 | done |
---|
| 370 | |
---|
| 371 | ThisSEDir=${R_SAVE}/${comp}/Analyse/SE |
---|
| 372 | IGCM_sys_TestDirArchive ${ThisSEDir} |
---|
| 373 | if [ $? = 0 ] ; then |
---|
| 374 | IGCM_debug_Print 2 "SE." |
---|
| 375 | NEW_SEDir=${NEW_R_SAVE}/${comp}/Analyse/SE |
---|
| 376 | IGCM_sys_MkdirArchive ${NEW_SEDir} |
---|
| 377 | |
---|
| 378 | MY_DODS_Rm ${comp}/Analyse/SE |
---|
| 379 | |
---|
| 380 | unset listfiles |
---|
| 381 | set +A listfiles -- $( find ${ThisSEDir} -type f ) |
---|
| 382 | |
---|
| 383 | MOVE_and_RENAME_files "listfiles" |
---|
| 384 | |
---|
| 385 | MY_DODS_Cp ${comp}/Analyse/SE |
---|
| 386 | fi |
---|
[349] | 387 | |
---|
| 388 | MY_DODS_Rm ${comp}/Analyse |
---|
| 389 | MY_DODS_Rm ${comp} |
---|
[342] | 390 | else |
---|
| 391 | IGCM_debug_Print 2 "nothing to do without Analyse." |
---|
| 392 | fi |
---|
| 393 | |
---|
| 394 | done |
---|
| 395 | |
---|
| 396 | #==================================================== |
---|
| 397 | #GRAPHS |
---|
| 398 | IGCM_debug_Print 1 "Move ATLAS" |
---|
| 399 | R_ATLAS=ATLAS |
---|
| 400 | IGCM_sys_TestDirArchive ${R_SAVE}/${R_ATLAS} |
---|
| 401 | if [ $? = 0 ] ; then |
---|
| 402 | # REPLACE_sed ${NEW_R_SAVE}/${R_ATLAS}/*/*/index.html ${NEW_R_SAVE}/${R_ATLAS} |
---|
| 403 | |
---|
| 404 | MY_DODS_Rm ${R_ATLAS} |
---|
| 405 | |
---|
[346] | 406 | IGCM_sys_Mv ${R_SAVE}/${R_ATLAS} ${NEW_R_SAVE}/${R_ATLAS} |
---|
| 407 | |
---|
[342] | 408 | MY_DODS_Cp ${R_ATLAS} |
---|
| 409 | fi |
---|
| 410 | |
---|
| 411 | IGCM_debug_Print 1 "Move MONITORING" |
---|
| 412 | R_MONITORING=MONITORING |
---|
| 413 | IGCM_sys_TestDirArchive ${R_SAVE}/${R_MONITORING} |
---|
| 414 | if [ $? = 0 ] ; then |
---|
| 415 | IGCM_sys_MkdirArchive ${NEW_R_SAVE}/${R_MONITORING} |
---|
| 416 | REPLACE_sed ${R_SAVE}/${R_MONITORING}/index.html ${NEW_R_SAVE}/${R_MONITORING} |
---|
[346] | 417 | REPLACE_sed ${R_SAVE}/${R_MONITORING}/run.card ${NEW_R_SAVE}/${R_MONITORING} |
---|
| 418 | REPLACE_sed ${R_SAVE}/${R_MONITORING}/config.card ${NEW_R_SAVE}/${R_MONITORING} |
---|
| 419 | IGCM_sys_Cp -rp ${R_SAVE}/${R_MONITORING} ${NEW_R_SAVE} |
---|
[342] | 420 | |
---|
| 421 | MY_DODS_Rm ${R_MONITORING} |
---|
[346] | 422 | IGCM_sys_Rm -rf ${R_SAVE}/${R_MONITORING} |
---|
[342] | 423 | |
---|
| 424 | MY_DODS_Cp ${R_MONITORING} |
---|
| 425 | fi |
---|
| 426 | |
---|
| 427 | |
---|
| 428 | #==================================================== |
---|
| 429 | #REBUILD |
---|
| 430 | |
---|
| 431 | if [ -d ${REBUILD_DIR} ] ; then |
---|
| 432 | |
---|
| 433 | IGCM_debug_Print 1 "Move REBUILD" |
---|
[350] | 434 | set +A LISTREBUILDS -- $( find ${REBUILD_DIR} -type d -not -name "*${config_UserChoices_JobName}" -a -not -name "*TMP" ) |
---|
[342] | 435 | |
---|
[350] | 436 | for ThisREBDir in ${LISTREBUILDS[*]} ; do |
---|
| 437 | rebdir=$( basename ${ThisREBDir} ) |
---|
[342] | 438 | IGCM_debug_Print 2 "${rebdir}." |
---|
| 439 | if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then |
---|
| 440 | IGCM_sys_MkdirArchive ${NEW_REBUILD_DIR}/${rebdir} |
---|
| 441 | else |
---|
| 442 | IGCM_sys_MkdirWork ${NEW_REBUILD_DIR}/${rebdir} |
---|
| 443 | fi |
---|
| 444 | REPLACE_sed ${REBUILD_DIR}/${rebdir}/rebuild.ksh ${NEW_REBUILD_DIR}/${rebdir} |
---|
[350] | 445 | IGCM_sys_Mv -f ${REBUILD_DIR}/${rebdir}/* ${NEW_REBUILD_DIR}/${rebdir}/ |
---|
[342] | 446 | done |
---|
| 447 | fi |
---|
| 448 | |
---|
| 449 | #==================================================== |
---|
| 450 | #List OLD R_SAVE and Ask for erase it ! |
---|
| 451 | |
---|
| 452 | IGCM_debug_Print 1 "ls of SAVE DIR :" |
---|
| 453 | ls --color -lR ${R_SAVE} |
---|
| 454 | |
---|
| 455 | echo "\033[1;31mPlease verify that ALL OLD DIRECTORY LISTED IS COMPLETLY EMPTY !" |
---|
| 456 | echo "\033[1;32mIf It is NOT EMPTY, you can TRY AGAIN this script." |
---|
| 457 | echo "\033[1;31mDo you REALLY want to erase all this directory ?" |
---|
| 458 | echo -n " Your answer (y/n) : \033[m" |
---|
[346] | 459 | if [ X${reponse} = X ] ; then |
---|
| 460 | read reponse |
---|
| 461 | fi |
---|
[342] | 462 | case ${reponse} in |
---|
| 463 | |
---|
| 464 | oui|OUI|o|y|yes|YES) |
---|
| 465 | echo "OK. It will be erased." |
---|
| 466 | IGCM_sys_Rm -Rf ${R_SAVE} |
---|
| 467 | echo "done." |
---|
| 468 | ;; |
---|
| 469 | non|NON|n|no|NO) |
---|
| 470 | echo "Nothing to do !" |
---|
| 471 | ;; |
---|
| 472 | esac |
---|
| 473 | |
---|
| 474 | |
---|
| 475 | ############################################################################################################# |
---|
| 476 | # Edit config.card, run.card and Job_${NewJobName} |
---|
| 477 | |
---|
| 478 | IGCM_debug_Print 1 "edit config.card" |
---|
| 479 | if [ X${config_UserChoices_SpaceName} != X ] ; then |
---|
| 480 | IGCM_card_WriteOption ${SUBMIT_DIR}/config.card UserChoices SpaceName ${NEW_SpaceName} |
---|
| 481 | fi |
---|
| 482 | if [ X${config_UserChoices_ExperimentName} != X ] ; then |
---|
| 483 | IGCM_card_WriteOption ${SUBMIT_DIR}/config.card UserChoices ExperimentName ${NEW_ExperimentName} |
---|
| 484 | fi |
---|
| 485 | IGCM_card_WriteOption ${SUBMIT_DIR}/config.card UserChoices JobName ${NEW_JobName} |
---|
| 486 | |
---|
| 487 | if [ -f ${SUBMIT_DIR}/run.card ] ; then |
---|
| 488 | IGCM_debug_Print 1 "edit run.card" |
---|
| 489 | sed -e "s&${R_SAVE}&${NEW_R_SAVE}&g" -e "s/${config_UserChoices_JobName}/${NEW_JobName}/g" \ |
---|
| 490 | ${SUBMIT_DIR}/run.card > ${RUN_DIR_PATH}/run.card |
---|
| 491 | IGCM_sys_Mv -f ${RUN_DIR_PATH}/run.card ${SUBMIT_DIR}/run.card |
---|
| 492 | |
---|
| 493 | if [ X${old_run_Configuration_PeriodState} != X ] ; then |
---|
| 494 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState ${old_run_Configuration_PeriodState} |
---|
| 495 | fi |
---|
| 496 | fi |
---|
| 497 | |
---|
| 498 | if [ -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ] ; then |
---|
| 499 | IGCM_debug_Print 1 "edit Job_${NEW_JobName}" |
---|
| 500 | sed -e "s&${R_SAVE}&${NEW_R_SAVE}&g" -e "s/${config_UserChoices_JobName}/${NEW_JobName}/g" \ |
---|
| 501 | ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} > ${SUBMIT_DIR}/Job_${NEW_JobName} |
---|
| 502 | chmod --reference=${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ${SUBMIT_DIR}/Job_${NEW_JobName} |
---|
| 503 | ls -la ${SUBMIT_DIR}/Job_${NEW_JobName} |
---|
| 504 | fi |
---|