source: trunk/libIGCM/AA_move-and-rename @ 376

Last change on this file since 376 was 373, checked in by sdipsl, 14 years ago

Remove libIGCM_sys_claude.ksh and libIGCM_sys_calculo.ksh
Update/homogenize all headers usgin the new fixed-length keyword syntax regarding properties keywords
$Rev:: 13 i $: Revision of last commit
$Author:: harry $: Author of last commit
$Date:: 2006-03-15 02:33:03 -0500 (Wed, 15 Mar 2006) $: Date of last commit
Add / update original author and contact when missing

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