1 | #!/bin/ksh |
---|
2 | |
---|
3 | #************************************************************** |
---|
4 | # Author: Sebastien Denvil, Martial Mancip |
---|
5 | # Contact: Martial.Mancip_ipsl.jussieu.fr |
---|
6 | # $Date$ |
---|
7 | # $Author$ |
---|
8 | # $Revision$ |
---|
9 | # IPSL (2006) |
---|
10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
11 | # History: |
---|
12 | # Modification: |
---|
13 | # |
---|
14 | #************************************************************** |
---|
15 | |
---|
16 | #========================================================= |
---|
17 | # The documentation of this file can be automatically generated |
---|
18 | # if you use the prefix #D- for comments to be extracted. |
---|
19 | # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" |
---|
20 | #========================================================= |
---|
21 | |
---|
22 | #D-#================================================== |
---|
23 | #D-LibIGCM_sys Default host |
---|
24 | #D-#================================================== |
---|
25 | #D- |
---|
26 | #D- This ksh library if a layer under some usefull |
---|
27 | #D- environment variables and shell commands. |
---|
28 | #D- All those definitions depend on host particularities. |
---|
29 | #D- It manages a stack mechanism and test validity of operations. |
---|
30 | #D- All function described bellow must be prefixed by IGCM_sys. |
---|
31 | |
---|
32 | #==================================================== |
---|
33 | # libIGCM_sys PARAMETERS |
---|
34 | #==================================================== |
---|
35 | |
---|
36 | #==================================================== |
---|
37 | #set DEBUG_sys to true to output calls of function |
---|
38 | typeset -r DEBUG_sys=${DEBUG_sys:=true} |
---|
39 | |
---|
40 | #==================================================== |
---|
41 | # Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get) |
---|
42 | typeset -r DRYRUN=${DRYRUN:=0} |
---|
43 | |
---|
44 | # YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE ! |
---|
45 | # ------------------------------------------------------------------------------------- |
---|
46 | # | DRYRUN= | Date computations, | sys_Get | Exe | sys_Put_Out; sys_Put_Rest | |
---|
47 | # | | Cp/Exe param files | | Chmod | | |
---|
48 | # | | Qsub | | | | |
---|
49 | # ------------------------------------------------------------------------------------- |
---|
50 | # | 0 | yes | yes | yes | yes | |
---|
51 | # ------------------------------------------------------------------------------------- |
---|
52 | # | 1 | yes | yes | yes | no | |
---|
53 | # ------------------------------------------------------------------------------------- |
---|
54 | # | 2 | yes | yes | no | no | |
---|
55 | # ------------------------------------------------------------------------------------- |
---|
56 | # | 3 | yes | no | no | no | |
---|
57 | # ------------------------------------------------------------------------------------- |
---|
58 | |
---|
59 | #===================================================== |
---|
60 | #Global Variables : |
---|
61 | #===================================================== |
---|
62 | # Language : "fr" or "en" |
---|
63 | typeset -r MYLANG="fr" |
---|
64 | |
---|
65 | #===================================================== |
---|
66 | # Host and user names |
---|
67 | # $hostname ou hostname |
---|
68 | typeset -r HOST=$( hostname ) |
---|
69 | # $username ou whoami |
---|
70 | typeset -r LOGIN=$( whoami ) |
---|
71 | # $hostname of the MASTER job |
---|
72 | typeset -r MASTER=${HOST} |
---|
73 | |
---|
74 | #D- |
---|
75 | #D-#================================================== |
---|
76 | #D-Program used in libIGCM |
---|
77 | #D-#================================================== |
---|
78 | |
---|
79 | # rsync with path |
---|
80 | typeset -r RSYNC=/usr/bin/rsync |
---|
81 | #RSYNC_opt args to rsync |
---|
82 | typeset -r RSYNC_opt="-va" |
---|
83 | #"-Lt -v" |
---|
84 | #==================================================== |
---|
85 | # Source Ferret |
---|
86 | . /home/${LOGIN}/.atlas_env_${HOST}_ksh |
---|
87 | |
---|
88 | #==================================================== |
---|
89 | # Host specific DIRECTORIES |
---|
90 | #==================================================== |
---|
91 | |
---|
92 | #==================================================== |
---|
93 | #- R_EXE (==> BIN_DIR = ${MODIPSL}/bin ) |
---|
94 | typeset -r R_EXE="${MODIPSL}/bin" |
---|
95 | |
---|
96 | #==================================================== |
---|
97 | #- SCRATCHDIR (=> ${R_DONNEES}) |
---|
98 | typeset -r SCRATCHDIR=/tmp |
---|
99 | |
---|
100 | #==================================================== |
---|
101 | #- SUBMIT_DIR : submission dir |
---|
102 | typeset SUBMIT_DIR=${SUBMIT_DIR:=${PWD}} |
---|
103 | |
---|
104 | #==================================================== |
---|
105 | #- ARCHIVE |
---|
106 | typeset -r ARCHIVE=/home |
---|
107 | |
---|
108 | #==================================================== |
---|
109 | #- libIGCM_POST |
---|
110 | typeset -r libIGCM_POST=${libIGCM} |
---|
111 | |
---|
112 | #==================================================== |
---|
113 | #- IN |
---|
114 | typeset -r R_IN=${R_IN:=${ARCHIVE}/${LOGIN}/IGCM} |
---|
115 | |
---|
116 | #==================================================== |
---|
117 | #- OUT |
---|
118 | typeset -r R_OUT=${ARCHIVE}/${LOGIN}/IGCM_OUT |
---|
119 | |
---|
120 | #==================================================== |
---|
121 | #- OUT_POST |
---|
122 | typeset -r R_OUT_POST=${R_OUT} |
---|
123 | |
---|
124 | #==================================================== |
---|
125 | #- RUN_DIR_PATH : Temporary working directory (=> TMP) |
---|
126 | typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/tmp$$} |
---|
127 | |
---|
128 | #==================================================== |
---|
129 | #- HOST_MPIRUN_COMMAND |
---|
130 | typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time mpirun"} |
---|
131 | |
---|
132 | #========================================================= |
---|
133 | #- Add "time" before mpirun command |
---|
134 | MPIRUN_COMMAND="time "${MPIRUN_COMMAND} |
---|
135 | echo ${MPIRUN_COMMAND} |
---|
136 | |
---|
137 | #==================================================== |
---|
138 | #- Max number of arguments passed to nco operator or demigration command |
---|
139 | UNIX_MAX_LIMIT=360 |
---|
140 | |
---|
141 | #D-#================================================== |
---|
142 | #D-function IGCM_sys_RshMaster |
---|
143 | #D-* Purpose: Master rsh command |
---|
144 | #D-* Examples: |
---|
145 | #D- |
---|
146 | function IGCM_sys_RshMaster { |
---|
147 | IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ |
---|
148 | ssh ${HOST} /bin/ksh <<-EOF |
---|
149 | export libIGCM=${libIGCM} |
---|
150 | export DEBUG_debug=${DEBUG_debug} |
---|
151 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh |
---|
152 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh |
---|
153 | ${@} |
---|
154 | EOF |
---|
155 | if [ $? -gt 0 ] ; then |
---|
156 | echo "IGCM_sys_RshMaster : erreur." |
---|
157 | IGCM_debug_Exit "IGCM_sys_RshMaster" |
---|
158 | fi |
---|
159 | IGCM_debug_PopStack "IGCM_sys_RshMaster" |
---|
160 | } |
---|
161 | |
---|
162 | #D-#================================================== |
---|
163 | #D-function IGCM_sys_RshArchive |
---|
164 | #D-* Purpose: Archive rsh command |
---|
165 | #D-* Examples: |
---|
166 | #D- |
---|
167 | function IGCM_sys_RshArchive { |
---|
168 | IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ |
---|
169 | /bin/ksh <<-EOF |
---|
170 | ${@} |
---|
171 | EOF |
---|
172 | if [ $? -gt 0 ] ; then |
---|
173 | echo "IGCM_sys_RshArchive : erreur." |
---|
174 | IGCM_debug_Exit "IGCM_sys_RshArchive" |
---|
175 | fi |
---|
176 | IGCM_debug_PopStack "IGCM_sys_RshArchive" |
---|
177 | } |
---|
178 | |
---|
179 | #D-#================================================== |
---|
180 | #D-function IGCM_sys_RshPost |
---|
181 | #D-* Purpose: Post-process rsh command |
---|
182 | #D-* Examples: |
---|
183 | #D- |
---|
184 | (( RshPNum = 0 )) |
---|
185 | function IGCM_sys_RshPost { |
---|
186 | IGCM_debug_PushStack "IGCM_sys_RshPost" $@ |
---|
187 | if ( $DEBUG_sys ) ; then |
---|
188 | echo "IGCM_sys_RshPost :" $@ |
---|
189 | fi |
---|
190 | #ssh ${HOST} exec /bin/ksh -vx $@ > out_RshPost.${RshPNum} |
---|
191 | ssh ${HOST} exec /bin/ksh $@ > out_RshPost.${RshPNum} |
---|
192 | if [ $? -gt 0 ] ; then |
---|
193 | echo "IGCM_sys_RshPost : erreur." |
---|
194 | IGCM_debug_Exit "IGCM_sys_RshPost" |
---|
195 | fi |
---|
196 | (( RshPNum = RshPNum + 1 )) |
---|
197 | IGCM_debug_PopStack "IGCM_sys_RshPost" |
---|
198 | } |
---|
199 | |
---|
200 | #D-#================================================== |
---|
201 | #D-function IGCM_sys_Mkdir |
---|
202 | #D-* Purpose: Master locale mkdir command |
---|
203 | #D-* Examples: |
---|
204 | #D- |
---|
205 | function IGCM_sys_Mkdir { |
---|
206 | IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ |
---|
207 | if ( $DEBUG_sys ) ; then |
---|
208 | echo "IGCM_sys_Mkdir :" $@ |
---|
209 | fi |
---|
210 | if [ ! -d ${1} ]; then |
---|
211 | \mkdir -p $1 |
---|
212 | if [ $? -gt 0 ] ; then |
---|
213 | echo "IGCM_sys_Mkdir : erreur." |
---|
214 | IGCM_debug_Exit "IGCM_sys_Mkdir" |
---|
215 | fi |
---|
216 | fi |
---|
217 | # vérification : |
---|
218 | if [ ! -d ${1} ] ; then |
---|
219 | echo "IGCM_sys_Mkdir : erreur." |
---|
220 | IGCM_debug_Exit "IGCM_sys_Mkdir" |
---|
221 | fi |
---|
222 | IGCM_debug_PopStack "IGCM_sys_Mkdir" |
---|
223 | } |
---|
224 | |
---|
225 | #D-#================================================== |
---|
226 | #D-function IGCM_sys_MkdirArchive |
---|
227 | #D-* Purpose: Mkdir on Archive |
---|
228 | #D-* Examples: |
---|
229 | #D- |
---|
230 | function IGCM_sys_MkdirArchive { |
---|
231 | IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ |
---|
232 | if ( $DEBUG_sys ) ; then |
---|
233 | echo "IGCM_sys_MkdirArchive :" $@ |
---|
234 | fi |
---|
235 | #- creation de repertoire sur le serveur fichier |
---|
236 | if [ ! -d ${1} ]; then |
---|
237 | \mkdir -p $1 |
---|
238 | if [ $? -gt 0 ] ; then |
---|
239 | echo "IGCM_sys_MkdirArchive : erreur." |
---|
240 | IGCM_debug_Exit "IGCM_sys_MkdirArchive" |
---|
241 | fi |
---|
242 | fi |
---|
243 | # vérification ?? : |
---|
244 | if [ ! -d ${1} ] ; then |
---|
245 | echo "IGCM_sys_MkdirArchive : erreur." |
---|
246 | IGCM_debug_Exit "IGCM_sys_MkdirArchive" |
---|
247 | fi |
---|
248 | IGCM_debug_PopStack "IGCM_sys_MkdirArchive" |
---|
249 | } |
---|
250 | |
---|
251 | #D-#================================================== |
---|
252 | #D-function IGCM_sys_MkdirWork |
---|
253 | #D-* Purpose: Mkdir on Work |
---|
254 | #D-* Examples: |
---|
255 | #D- |
---|
256 | function IGCM_sys_MkdirWork { |
---|
257 | IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ |
---|
258 | if ( $DEBUG_sys ) ; then |
---|
259 | echo "IGCM_sys_MkdirWork :" $@ |
---|
260 | fi |
---|
261 | #- creation de repertoire sur le serveur fichier |
---|
262 | if [ ! -d ${1} ]; then |
---|
263 | \mkdir -p $1 |
---|
264 | if [ $? -gt 0 ] ; then |
---|
265 | echo "IGCM_sys_MkdirWork : erreur." |
---|
266 | IGCM_debug_Exit "IGCM_sys_MkdirWork" |
---|
267 | fi |
---|
268 | fi |
---|
269 | # vérification ?? : |
---|
270 | if [ ! -d ${1} ] ; then |
---|
271 | echo "IGCM_sys_MkdirWork : erreur." |
---|
272 | IGCM_debug_Exit "IGCM_sys_MkdirWork" |
---|
273 | fi |
---|
274 | IGCM_debug_PopStack "IGCM_sys_MkdirWork" |
---|
275 | } |
---|
276 | IGCM_sys_MkdirWork ${RUN_DIR_PATH} |
---|
277 | echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok." |
---|
278 | |
---|
279 | #D-#================================================== |
---|
280 | #D-function IGCM_sys_Cd |
---|
281 | #D-* Purpose: master cd command |
---|
282 | #D-* Examples: |
---|
283 | #D- |
---|
284 | function IGCM_sys_Cd { |
---|
285 | IGCM_debug_PushStack "IGCM_sys_Cd" $@ |
---|
286 | if ( $DEBUG_sys ) ; then |
---|
287 | echo "IGCM_sys_Cd :" $@ |
---|
288 | fi |
---|
289 | \cd $1 |
---|
290 | if [ $? -gt 0 ] ; then |
---|
291 | echo "IGCM_sys_Cd : erreur." |
---|
292 | IGCM_debug_Exit "IGCM_sys_Cd" |
---|
293 | fi |
---|
294 | IGCM_debug_PopStack "IGCM_sys_Cd" |
---|
295 | } |
---|
296 | |
---|
297 | #D-#================================================== |
---|
298 | #D-function IGCM_sys_Chmod |
---|
299 | #D-* Purpose: Chmod |
---|
300 | #D-* Examples: |
---|
301 | #D- |
---|
302 | function IGCM_sys_Chmod { |
---|
303 | IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@ |
---|
304 | if ( $DEBUG_sys ) ; then |
---|
305 | echo "IGCM_sys_Chmod :" $@ |
---|
306 | fi |
---|
307 | if [ $DRYRUN -le 1 ]; then |
---|
308 | \chmod $@ |
---|
309 | if [ $? -gt 0 ] ; then |
---|
310 | echo "IGCM_sys_Chmod : erreur." |
---|
311 | IGCM_debug_Exit "IGCM_sys_Chmod" |
---|
312 | fi |
---|
313 | else |
---|
314 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
315 | fi |
---|
316 | IGCM_debug_PopStack "IGCM_sys_Chmod" |
---|
317 | } |
---|
318 | |
---|
319 | #D-#================================================== |
---|
320 | #D-function IGCM_sys_FileSize |
---|
321 | #D-* Purpose: Filesize |
---|
322 | #D-* Examples: |
---|
323 | #D- |
---|
324 | function IGCM_sys_FileSize { |
---|
325 | IGCM_debug_PushStack "IGCM_sys_FileSize" $@ |
---|
326 | |
---|
327 | typeset sizeF |
---|
328 | set +A sizeF -- $( ls -la ${1} ) |
---|
329 | if [ $? -gt 0 ] ; then |
---|
330 | IGCM_debug_Exit "IGCM_sys_FileSize" |
---|
331 | fi |
---|
332 | eval ${2}=${sizeF[4]} |
---|
333 | |
---|
334 | IGCM_debug_PopStack "IGCM_sys_FileSize" |
---|
335 | } |
---|
336 | |
---|
337 | #D-#================================================== |
---|
338 | #D-function IGCM_sys_TestDir |
---|
339 | #D-* Purpose: Test Directory that must exists |
---|
340 | #D-* Examples: |
---|
341 | #D- |
---|
342 | function IGCM_sys_TestDir { |
---|
343 | IGCM_debug_PushStack "IGCM_sys_TestDir" $@ |
---|
344 | if ( $DEBUG_sys ) ; then |
---|
345 | echo "IGCM_sys_TestDir :" $@ |
---|
346 | fi |
---|
347 | typeset ExistFlag |
---|
348 | ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) |
---|
349 | IGCM_debug_PopStack "IGCM_sys_TestDir" |
---|
350 | |
---|
351 | return ${ExistFlag} |
---|
352 | } |
---|
353 | |
---|
354 | #D-#================================================== |
---|
355 | #D-function IGCM_sys_TestDirArchive |
---|
356 | #D-* Purpose: Test Directory that must exists on Archive |
---|
357 | #D-* Examples: |
---|
358 | #D- |
---|
359 | function IGCM_sys_TestDirArchive { |
---|
360 | IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ |
---|
361 | if ( $DEBUG_sys ) ; then |
---|
362 | echo "IGCM_sys_TestDirArchive :" $@ |
---|
363 | fi |
---|
364 | typeset ExistFlag |
---|
365 | ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) |
---|
366 | IGCM_debug_PopStack "IGCM_sys_TestDirArchive" |
---|
367 | |
---|
368 | return ${ExistFlag} |
---|
369 | } |
---|
370 | |
---|
371 | #D-#================================================== |
---|
372 | #D-function IGCM_sys_TestFileArchive |
---|
373 | #D-* Purpose: Test file that must NOT EXISTS on Archive |
---|
374 | #D-* Examples: |
---|
375 | #D- |
---|
376 | function IGCM_sys_TestFileArchive { |
---|
377 | IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ |
---|
378 | if ( $DEBUG_sys ) ; then |
---|
379 | echo "IGCM_sys_TestFileArchive :" $@ |
---|
380 | fi |
---|
381 | typeset ExistFlag |
---|
382 | ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) |
---|
383 | IGCM_debug_PopStack "IGCM_sys_TestFileArchive" |
---|
384 | |
---|
385 | return ${ExistFlag} |
---|
386 | } |
---|
387 | |
---|
388 | #D-#================================================== |
---|
389 | #D-function IGCM_sys_CountFileArchive |
---|
390 | #D-* Purpose: Count files on Archive filesystem |
---|
391 | #D-* Examples: |
---|
392 | #D- |
---|
393 | function IGCM_sys_CountFileArchive { |
---|
394 | IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ |
---|
395 | ls ${@} 2>/dev/null | wc -l |
---|
396 | if [ $? -gt 0 ] ; then |
---|
397 | echo "IGCM_sys_CountFileArchive : erreur." |
---|
398 | fi |
---|
399 | IGCM_debug_PopStack "IGCM_sys_CountFileArchive" |
---|
400 | } |
---|
401 | |
---|
402 | #D-#================================================== |
---|
403 | #D-function IGCM_sys_Tree |
---|
404 | #D-* Purpose: Tree directories with files on ${ARCHIVE} |
---|
405 | #D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT} |
---|
406 | #D- |
---|
407 | function IGCM_sys_Tree { |
---|
408 | IGCM_debug_PushStack "IGCM_sys_Tree" $@ |
---|
409 | if ( $DEBUG_sys ) ; then |
---|
410 | echo "IGCM_sys_Tree :" $@ |
---|
411 | fi |
---|
412 | |
---|
413 | \tree -f $@ |
---|
414 | |
---|
415 | IGCM_debug_PopStack "IGCM_sys_Tree" |
---|
416 | } |
---|
417 | |
---|
418 | #D-#================================================== |
---|
419 | #D-function IGCM_sys_Tar |
---|
420 | #D-* Purpose: master un-tar command |
---|
421 | #D-* Examples: |
---|
422 | #D- |
---|
423 | function IGCM_sys_Tar { |
---|
424 | IGCM_debug_PushStack "IGCM_sys_Tar" $@ |
---|
425 | if ( $DEBUG_sys ) ; then |
---|
426 | echo "IGCM_sys_Tar :" $@ |
---|
427 | fi |
---|
428 | \tar cvf $@ |
---|
429 | if [ $? -gt 0 ] ; then |
---|
430 | echo "IGCM_sys_Tar : erreur." |
---|
431 | IGCM_debug_Exit "IGCM_sys_Tar" |
---|
432 | fi |
---|
433 | \tar tvf $1 |
---|
434 | |
---|
435 | IGCM_debug_PopStack "IGCM_sys_Tar" |
---|
436 | } |
---|
437 | |
---|
438 | #D-#================================================== |
---|
439 | #D-function IGCM_sys_UnTar |
---|
440 | #D-* Purpose: master un-tar command |
---|
441 | #D-* Examples: |
---|
442 | #D- |
---|
443 | function IGCM_sys_UnTar { |
---|
444 | IGCM_debug_PushStack "IGCM_sys_UnTar" $@ |
---|
445 | if ( $DEBUG_sys ) ; then |
---|
446 | echo "IGCM_sys_UnTar :" $@ |
---|
447 | fi |
---|
448 | \tar xvf $1 |
---|
449 | if [ $? -gt 0 ] ; then |
---|
450 | echo "IGCM_sys_UnTar : erreur." |
---|
451 | IGCM_debug_Exit "IGCM_sys_UnTar" |
---|
452 | fi |
---|
453 | IGCM_debug_PopStack "IGCM_sys_UnTar" |
---|
454 | } |
---|
455 | |
---|
456 | #D-#================================================== |
---|
457 | #D-function IGCM_sys_Qsub |
---|
458 | #D-* Purpose: Qsub new job |
---|
459 | #D-* Examples: |
---|
460 | #D- |
---|
461 | function IGCM_sys_Qsub { |
---|
462 | IGCM_debug_PushStack "IGCM_sys_Qsub" $@ |
---|
463 | if ( $DEBUG_sys ) ; then |
---|
464 | echo "IGCM_sys_Qsub :" $@ |
---|
465 | fi |
---|
466 | echo "ssh -l ${LOGIN} ${HOST} ""cd ${SUBMIT_DIR} ; ${@}"" > ${Script_Output} 2>&1 &" |
---|
467 | ssh -l ${LOGIN} ${HOST} "cd ${SUBMIT_DIR} ; ${@}" > ${Script_Output} 2>&1 & |
---|
468 | if [ $? -gt 0 ] ; then |
---|
469 | echo "IGCM_sys_Qsub : erreur." |
---|
470 | IGCM_debug_Exit "IGCM_sys_Qsub" |
---|
471 | fi |
---|
472 | IGCM_debug_PopStack "IGCM_sys_Qsub" |
---|
473 | } |
---|
474 | |
---|
475 | #D-#================================================== |
---|
476 | #D-function IGCM_sys_QsubPost |
---|
477 | #D-* Purpose: Qsub new job on scalaire |
---|
478 | #D-* Examples: |
---|
479 | #D- |
---|
480 | function IGCM_sys_QsubPost { |
---|
481 | IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ |
---|
482 | if ( $DEBUG_sys ) ; then |
---|
483 | echo "IGCM_sys_QsubPost :" $@ |
---|
484 | fi |
---|
485 | #echo "ssh -x -l ${LOGIN} ${HOST} ${3} > ${2} 2>&1 &" |
---|
486 | # ssh -x -l ${LOGIN} ${HOST} |
---|
487 | echo "${libIGCM_POST}/$1.job > ${POST_DIR}/$1.${PeriodDateEnd}.out 2>&1 &" |
---|
488 | ${libIGCM_POST}/$1.job > ${POST_DIR}/$1.${PeriodDateEnd}.out 2>&1 & |
---|
489 | # ${3} > ${2} 2>&1 & |
---|
490 | if [ $? -gt 0 ] ; then |
---|
491 | echo "IGCM_sys_QsubPost : erreur " $@ |
---|
492 | IGCM_debug_Exit "IGCM_sys_QsubPost" |
---|
493 | fi |
---|
494 | IGCM_debug_PopStack "IGCM_sys_QsubPost" |
---|
495 | } |
---|
496 | |
---|
497 | #D-************************* |
---|
498 | #D- File transfer functions |
---|
499 | #D-************************* |
---|
500 | #D- |
---|
501 | |
---|
502 | #D-#================================================== |
---|
503 | #D-function IGCM_sys_Rsync_out |
---|
504 | #D-* Purpose: treat return val of rsync |
---|
505 | #D-* Examples: IGCM_sys_Rsync_out out_RET_rsync |
---|
506 | #D- Error values and explanations can depend on your system version. |
---|
507 | function IGCM_sys_Rsync_out { |
---|
508 | RET=$1 |
---|
509 | if [ ! $RET ] ; then |
---|
510 | echo "rsync error !" |
---|
511 | fi |
---|
512 | |
---|
513 | if [ $MYLANG = "fr" ]; then |
---|
514 | case $RET in |
---|
515 | 0) return ;; |
---|
516 | 1) echo "Erreur de rsync ; RERR_SYNTAX : " |
---|
517 | echo "Erreur de syntaxe ou d'utilisation." |
---|
518 | return;; |
---|
519 | 2) echo "Erreur de rsync ; RERR_PROTOCOL : " |
---|
520 | echo "Incompatibilité de protocole." |
---|
521 | return;; |
---|
522 | 3) echo "Erreur de rsync ; RERR_FILESELECT 3" |
---|
523 | echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" |
---|
524 | echo "répertoires" |
---|
525 | return;; |
---|
526 | 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" |
---|
527 | echo "Action demandée non supportée : une tentative de manipulation de" |
---|
528 | echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" |
---|
529 | echo "été faite ; ou une option qui est supportée par le client mais" |
---|
530 | echo "pas par le serveur a été spécifiée." |
---|
531 | return;; |
---|
532 | 10) echo "Erreur de rsync ; RERR_SOCKETIO" |
---|
533 | echo "Erreur dans le socket d'entrée sortie" |
---|
534 | return;; |
---|
535 | 11) echo "Erreur de rsync ; RERR_FILEIO" |
---|
536 | echo "Erreur d'entrée sortie fichier" |
---|
537 | return;; |
---|
538 | 12) echo "Erreur de rsync ; RERR_STREAMIO" |
---|
539 | echo "Erreur dans flux de donnée du protocole rsync" |
---|
540 | return;; |
---|
541 | 13) echo "Erreur de rsync ; RERR_MESSAGEIO" |
---|
542 | echo "Erreur avec les diagnostics du programme" |
---|
543 | return;; |
---|
544 | 14) echo "Erreur de rsync ; RERR_IPC" |
---|
545 | echo "Erreur dans le code IPC" |
---|
546 | return;; |
---|
547 | 20) echo "Erreur de rsync ; RERR_SIGNAL" |
---|
548 | echo "SIGUSR1 ou SIGINT reçu" |
---|
549 | return;; |
---|
550 | 21) echo "Erreur de rsync ; RERR_WAITCHILD" |
---|
551 | echo "Une erreur retournée par waitpid()" |
---|
552 | return;; |
---|
553 | 22) echo "Erreur de rsync ; RERR_MALLOC" |
---|
554 | echo "Erreur lors de l'allocation des tampons de mémoire de coeur" |
---|
555 | return;; |
---|
556 | 23) echo "" |
---|
557 | echo "Erreur fichier inexistant" |
---|
558 | return;; |
---|
559 | 30) echo "Erreur de rsync ; RERR_TIMEOUT" |
---|
560 | echo "Temps d'attente écoulé dans l'envoi/réception de données" |
---|
561 | return;; |
---|
562 | *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET |
---|
563 | return;; |
---|
564 | esac |
---|
565 | elif [ $MYLANG = "en" ] ; then |
---|
566 | case $RET in |
---|
567 | 0) return;; |
---|
568 | 1) echo "rsync error : Syntax or usage error " |
---|
569 | return;; |
---|
570 | 2) echo "rsync error : Protocol incompatibility " |
---|
571 | return;; |
---|
572 | 3) echo "rsync error : Errors selecting input/output files, dirs" |
---|
573 | return;; |
---|
574 | 4) echo "rsync error : Requested action not supported: an attempt" |
---|
575 | echo "was made to manipulate 64-bit files on a platform that cannot support" |
---|
576 | echo "them; or an option was specified that is supported by the client and" |
---|
577 | echo "not by the server." |
---|
578 | return;; |
---|
579 | 5) echo "rsync error : Error starting client-server protocol" |
---|
580 | return;; |
---|
581 | 10) echo "rsync error : Error in socket I/O " |
---|
582 | return;; |
---|
583 | 11) echo "rsync error : Error in file I/O " |
---|
584 | return;; |
---|
585 | 12) echo "rsync error : Error in rsync protocol data stream " |
---|
586 | return;; |
---|
587 | 13) echo "rsync error : Errors with program diagnostics " |
---|
588 | return;; |
---|
589 | 14) echo "rsync error : Error in IPC code " |
---|
590 | return;; |
---|
591 | 20) echo "rsync error : Received SIGUSR1 or SIGINT " |
---|
592 | return;; |
---|
593 | 21) echo "rsync error : Some error returned by waitpid() " |
---|
594 | return;; |
---|
595 | 22) echo "rsync error : Error allocating core memory buffers " |
---|
596 | return;; |
---|
597 | 23) echo "rsync error : Partial transfer due to error" |
---|
598 | return;; |
---|
599 | 24) echo "rsync error : Partial transfer due to vanished source files" |
---|
600 | return;; |
---|
601 | 30) echo "rsync error : Timeout in data send/receive " |
---|
602 | return;; |
---|
603 | *) echo "rsync error : return code of rsync unknown :" $RET |
---|
604 | return;; |
---|
605 | esac |
---|
606 | else |
---|
607 | echo "unknown language $MYLANG." |
---|
608 | return |
---|
609 | fi |
---|
610 | } |
---|
611 | |
---|
612 | #D-#================================================== |
---|
613 | #D-function IGCM_sys_Cp |
---|
614 | #D-* Purpose: generic cp |
---|
615 | #D-* Examples: |
---|
616 | #D- |
---|
617 | function IGCM_sys_Cp { |
---|
618 | IGCM_debug_PushStack "IGCM_sys_Cp" $@ |
---|
619 | if ( $DEBUG_sys ) ; then |
---|
620 | echo "IGCM_sys_Cp :" $@ |
---|
621 | fi |
---|
622 | |
---|
623 | typeset RET |
---|
624 | |
---|
625 | echo cp --preserve=timestamps $@ > out_rsync 2>&1 |
---|
626 | \cp --preserve=timestamps $@ >> out_rsync 2>&1 |
---|
627 | RET=$? |
---|
628 | |
---|
629 | if [ ${RET} -gt 0 ] ; then |
---|
630 | echo "IGCM_sys_Cp : error." |
---|
631 | cat out_rsync |
---|
632 | IGCM_debug_Exit "IGCM_sys_Cp" |
---|
633 | fi |
---|
634 | IGCM_debug_PopStack "IGCM_sys_Cp" |
---|
635 | } |
---|
636 | |
---|
637 | #D-#================================================== |
---|
638 | #D-function IGCM_sys_Rm |
---|
639 | #D-* Purpose: generic rm |
---|
640 | #D-* Examples: |
---|
641 | #D- |
---|
642 | function IGCM_sys_Rm { |
---|
643 | IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ |
---|
644 | if ( $DEBUG_sys ) ; then |
---|
645 | echo "IGCM_sys_Rm :" $@ |
---|
646 | fi |
---|
647 | |
---|
648 | typeset RET |
---|
649 | |
---|
650 | echo rm $@ > out_rsync 2>&1 |
---|
651 | \rm $@ >> out_rsync 2>&1 |
---|
652 | RET=$? |
---|
653 | |
---|
654 | if [ ${RET} -gt 0 ] ; then |
---|
655 | echo "IGCM_sys_Rm : error." |
---|
656 | cat out_rsync |
---|
657 | IGCM_debug_Exit "IGCM_sys_Rm" |
---|
658 | fi |
---|
659 | IGCM_debug_PopStack "IGCM_sys_Rm" |
---|
660 | } |
---|
661 | |
---|
662 | #D-#================================================== |
---|
663 | #D-function IGCM_sys_Mv |
---|
664 | #D-* Purpose: generic move |
---|
665 | #D-* Examples: |
---|
666 | #D- |
---|
667 | function IGCM_sys_Mv { |
---|
668 | IGCM_debug_PushStack "IGCM_sys_Mv" $@ |
---|
669 | if ( $DEBUG_sys ) ; then |
---|
670 | echo "IGCM_sys_Mv :" $@ |
---|
671 | fi |
---|
672 | |
---|
673 | typeset RET |
---|
674 | |
---|
675 | echo mv $@ > out_rsync 2>&1 |
---|
676 | \mv $@ >> out_rsync 2>&1 |
---|
677 | RET=$? |
---|
678 | |
---|
679 | if [ ${RET} -gt 0 ] ; then |
---|
680 | echo "IGCM_sys_Mv : error in mv." |
---|
681 | cat out_rsync |
---|
682 | IGCM_debug_Exit "IGCM_sys_Mv" |
---|
683 | fi |
---|
684 | |
---|
685 | IGCM_debug_PopStack "IGCM_sys_Mv" |
---|
686 | } |
---|
687 | |
---|
688 | #D-#================================================== |
---|
689 | #D-function IGCM_sys_Put_Dir |
---|
690 | #D-* Purpose: Copy a complete directory on $(ARCHIVE) |
---|
691 | #D-* Examples: |
---|
692 | #D- |
---|
693 | function IGCM_sys_Put_Dir { |
---|
694 | IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ |
---|
695 | if ( $DEBUG_sys ) ; then |
---|
696 | echo "IGCM_sys_Put_Dir :" $@ |
---|
697 | fi |
---|
698 | if [ $DRYRUN = 0 ]; then |
---|
699 | if [ ! -d ${1} ] ; then |
---|
700 | echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." |
---|
701 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
702 | return |
---|
703 | fi |
---|
704 | |
---|
705 | typeset RET |
---|
706 | |
---|
707 | # Only if we use rsync |
---|
708 | #IGCM_sys_TestDirArchive $( dirname $2 ) |
---|
709 | # |
---|
710 | #USUAL WAY |
---|
711 | \cp -R $1 $2 > out_rsync 2>&1 |
---|
712 | RET=$? |
---|
713 | |
---|
714 | if [ ${RET} -gt 0 ] ; then |
---|
715 | echo "IGCM_sys_Put_Dir : error." |
---|
716 | cat out_rsync |
---|
717 | IGCM_debug_Exit "IGCM_sys_Put_Dir" |
---|
718 | fi |
---|
719 | else |
---|
720 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
721 | fi |
---|
722 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
723 | } |
---|
724 | |
---|
725 | #D-#================================================== |
---|
726 | #D-function IGCM_sys_Get_Dir |
---|
727 | #D-* Purpose: Copy a complete directory from $(ARCHIVE) |
---|
728 | #D-* Examples: |
---|
729 | #D- |
---|
730 | function IGCM_sys_Get_Dir { |
---|
731 | IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ |
---|
732 | if ( $DEBUG_sys ) ; then |
---|
733 | echo "IGCM_sys_Get_Dir :" $@ |
---|
734 | fi |
---|
735 | if [ $DRYRUN = 0 ]; then |
---|
736 | if [ ! -d ${1} ] ; then |
---|
737 | echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." |
---|
738 | IGCM_debug_PopStack "IGCM_sys_Get_Dir" |
---|
739 | return |
---|
740 | fi |
---|
741 | |
---|
742 | typeset RET |
---|
743 | |
---|
744 | #USUAL WAY |
---|
745 | \cp -R $1 $2 > out_rsync 2>&1 |
---|
746 | RET=$? |
---|
747 | |
---|
748 | if [ ${RET} -gt 0 ] ; then |
---|
749 | echo "IGCM_sys_Get_Dir : error." |
---|
750 | cat out_rsync |
---|
751 | IGCM_debug_Exit "IGCM_sys_Get_Dir" |
---|
752 | fi |
---|
753 | else |
---|
754 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
755 | fi |
---|
756 | IGCM_debug_PopStack "IGCM_sys_Get_Dir" |
---|
757 | } |
---|
758 | |
---|
759 | #D-#================================================== |
---|
760 | #D-function IGCM_sys_Get_Master |
---|
761 | #D-* Purpose: Copy a complete directory from MASTER filesystem |
---|
762 | #D-* Examples: |
---|
763 | #D- |
---|
764 | function IGCM_sys_Get_Master { |
---|
765 | IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ |
---|
766 | if ( $DEBUG_sys ) ; then |
---|
767 | echo "IGCM_sys_Get_Master :" $@ |
---|
768 | fi |
---|
769 | if [ $DRYRUN = 0 ]; then |
---|
770 | if [ ! -d ${1} ] ; then |
---|
771 | echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." |
---|
772 | IGCM_debug_PopStack "IGCM_sys_Get_Master" |
---|
773 | return |
---|
774 | fi |
---|
775 | |
---|
776 | typeset RET |
---|
777 | sleep 60 |
---|
778 | |
---|
779 | #USUAL WAY |
---|
780 | cp -R $1 $2 > out_rsync 2>&1 |
---|
781 | RET=$? |
---|
782 | |
---|
783 | if [ ${RET} -gt 0 ] ; then |
---|
784 | echo "IGCM_sys_Get_Master : error." |
---|
785 | cat out_rsync |
---|
786 | IGCM_debug_Exit "IGCM_sys_Get_Master" |
---|
787 | fi |
---|
788 | else |
---|
789 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
790 | fi |
---|
791 | IGCM_debug_PopStack "IGCM_sys_Get_Master" |
---|
792 | } |
---|
793 | |
---|
794 | #D-#================================================== |
---|
795 | #D-function IGCM_sys_Put_Rest |
---|
796 | #D-* Purpose: Put computied restarts on $(ARCHIVE). |
---|
797 | #D- File and target directory must exist. |
---|
798 | #D-* Examples: |
---|
799 | #D- |
---|
800 | function IGCM_sys_Put_Rest { |
---|
801 | IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ |
---|
802 | if ( $DEBUG_sys ) ; then |
---|
803 | echo "IGCM_sys_Put_Rest :" $@ |
---|
804 | fi |
---|
805 | if [ $DRYRUN = 0 ]; then |
---|
806 | |
---|
807 | IGCM_sys_TestDirArchive $( dirname $2 ) |
---|
808 | |
---|
809 | if [ ! -f ${1} ] ; then |
---|
810 | echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." |
---|
811 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
812 | fi |
---|
813 | if [ X${JobType} = XRUN ] ; then |
---|
814 | IGCM_sys_Chmod 444 ${1} |
---|
815 | fi |
---|
816 | |
---|
817 | typeset RET |
---|
818 | |
---|
819 | echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 |
---|
820 | ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 |
---|
821 | RET=$? |
---|
822 | IGCM_sys_Rsync_out $RET |
---|
823 | |
---|
824 | ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync |
---|
825 | (( RET=RET+$? )) |
---|
826 | |
---|
827 | if [ ${RET} -gt 0 ] ; then |
---|
828 | echo "IGCM_sys_Put_Rest : error." |
---|
829 | cat out_rsync |
---|
830 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
831 | fi |
---|
832 | else |
---|
833 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
834 | fi |
---|
835 | IGCM_debug_PopStack "IGCM_sys_Put_Rest" |
---|
836 | } |
---|
837 | |
---|
838 | #D-#================================================== |
---|
839 | #D-function IGCM_sys_Put_Out |
---|
840 | #D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly |
---|
841 | #D-* Examples: |
---|
842 | #D- |
---|
843 | function IGCM_sys_Put_Out { |
---|
844 | IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ |
---|
845 | if ( $DEBUG_sys ) ; then |
---|
846 | echo "IGCM_sys_Put_Out :" $@ |
---|
847 | fi |
---|
848 | if [ $DRYRUN = 0 ]; then |
---|
849 | if [ -f ${1} ] ; then |
---|
850 | if [ ! -d $( dirname $2 ) ] ; then |
---|
851 | IGCM_sys_MkdirArchive $( dirname $2 ) |
---|
852 | fi |
---|
853 | else |
---|
854 | echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." |
---|
855 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
856 | return 1 |
---|
857 | fi |
---|
858 | |
---|
859 | typeset RET |
---|
860 | # |
---|
861 | if [ X${JobType} = XRUN ] ; then |
---|
862 | IGCM_sys_Chmod 444 ${1} |
---|
863 | fi |
---|
864 | # |
---|
865 | |
---|
866 | echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 |
---|
867 | ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 |
---|
868 | RET=$? |
---|
869 | IGCM_sys_Rsync_out $RET |
---|
870 | |
---|
871 | ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync |
---|
872 | (( RET=RET+$? )) |
---|
873 | |
---|
874 | if [ ${RET} -gt 0 ] ; then |
---|
875 | echo "IGCM_sys_Put_Out : error." |
---|
876 | cat out_rsync |
---|
877 | IGCM_debug_Exit "IGCM_sys_Put_Out" |
---|
878 | fi |
---|
879 | else |
---|
880 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
881 | fi |
---|
882 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
883 | return 0 |
---|
884 | } |
---|
885 | |
---|
886 | #D-#================================================== |
---|
887 | #D-function IGCM_sys_Get |
---|
888 | #D-* Purpose: Get a file from ${ARCHIVE} |
---|
889 | #D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX |
---|
890 | #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ |
---|
891 | function IGCM_sys_Get { |
---|
892 | IGCM_debug_PushStack "IGCM_sys_Get" $@ |
---|
893 | |
---|
894 | typeset DEST RET dm_liste ifile target |
---|
895 | |
---|
896 | if ( $DEBUG_sys ) ; then |
---|
897 | echo "IGCM_sys_Get :" $@ |
---|
898 | fi |
---|
899 | if [ $DRYRUN -le 2 ]; then |
---|
900 | if [ X${1} = X'/l' ] ; then |
---|
901 | # test if the first file is present in the old computation : |
---|
902 | eval set +A dm_liste \${${2}} |
---|
903 | else |
---|
904 | dm_liste=${1} |
---|
905 | fi |
---|
906 | eval DEST=\${${#}} |
---|
907 | |
---|
908 | # test if the (first) file is present in the old computation : |
---|
909 | IGCM_sys_TestFileArchive ${dm_liste[0]} |
---|
910 | RET=$? |
---|
911 | if [ ${RET} -gt 0 ] ; then |
---|
912 | echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." |
---|
913 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
914 | return |
---|
915 | fi |
---|
916 | |
---|
917 | (( RET=0 )) |
---|
918 | for target in ${dm_liste[*]} ; do |
---|
919 | \cp ${target} ${DEST} >> out_rsync 2>&1 |
---|
920 | (( RET=RET+$? )) |
---|
921 | done |
---|
922 | |
---|
923 | # echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1 |
---|
924 | # ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1 |
---|
925 | # RET=$? |
---|
926 | # IGCM_sys_Rsync_out $RET |
---|
927 | |
---|
928 | # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync |
---|
929 | # (( RET=RET+$? )) |
---|
930 | |
---|
931 | if [ ${RET} -gt 0 ] ; then |
---|
932 | echo "IGCM_sys_Get : copy error." |
---|
933 | cat out_rsync |
---|
934 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
935 | fi |
---|
936 | else |
---|
937 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
938 | fi |
---|
939 | IGCM_debug_PopStack "IGCM_sys_Get" |
---|
940 | } |
---|
941 | |
---|
942 | #D-#================================================== |
---|
943 | #D-function IGCM_sys_Put_Dods |
---|
944 | #D-* Purpose: DO NOTHING ! Put $(ARCHIVE) files on DODS internet protocole. |
---|
945 | #D-* Examples: |
---|
946 | #D- |
---|
947 | function IGCM_sys_Put_Dods { |
---|
948 | IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ |
---|
949 | if ( $DEBUG_sys ) ; then |
---|
950 | echo "IGCM_sys_Put_Dods :" $@ |
---|
951 | fi |
---|
952 | if [ $DRYRUN = 0 ]; then |
---|
953 | if [ ! -f ${1} ] ; then |
---|
954 | echo "WARNING : IGCM_sys_Put_Dods ${1} DOES NOT EXIST ." |
---|
955 | IGCM_debug_PopStack "IGCM_sys_Put_Dods" |
---|
956 | return |
---|
957 | fi |
---|
958 | #DO NOTHING |
---|
959 | else |
---|
960 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
961 | fi |
---|
962 | IGCM_debug_PopStack "IGCM_sys_Put_Dods" |
---|
963 | } |
---|
964 | |
---|
965 | ############################################################## A REVOIR !! |
---|
966 | |
---|
967 | #D-#================================================== |
---|
968 | #D-function IGCM_sys_Rapatrie |
---|
969 | #D-* Purpose: Rapatrie |
---|
970 | #D-* Examples: |
---|
971 | #D- |
---|
972 | function IGCM_sys_Rapatrie { |
---|
973 | IGCM_debug_PushStack "IGCM_sys_Rapatrie" $@ |
---|
974 | if ( $DEBUG_sys ) ; then |
---|
975 | echo "IGCM_sys_Rapatrie :" $@ |
---|
976 | fi |
---|
977 | |
---|
978 | typeset RET=0 |
---|
979 | |
---|
980 | IGCM_sys_Get ${R_STOCKAGE}/$2 $1 ; |
---|
981 | let $(( RET=RET+$? )) |
---|
982 | IGCM_sys_Cd $1 ; |
---|
983 | let $(( RET=RET+$? )) |
---|
984 | IGCM_sys_UnTar $2 ; |
---|
985 | let $(( RET=RET+$? )) |
---|
986 | |
---|
987 | if [ ${RET} -gt 0 ] ; then |
---|
988 | echo "IGCM_sys_Rapatrie : erreur." |
---|
989 | IGCM_debug_Exit "IGCM_sys_Rapatrie" |
---|
990 | fi |
---|
991 | IGCM_debug_PopStack "IGCM_sys_Rapatrie" |
---|
992 | } |
---|
993 | |
---|
994 | ############################################################## A FINIR !! |
---|
995 | |
---|
996 | #D-#================================================== |
---|
997 | #D-function IGCM_sys_GetDate_FichWork |
---|
998 | #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK |
---|
999 | #D-* Examples: |
---|
1000 | #D- |
---|
1001 | function IGCM_sys_GetDate_FichWork { |
---|
1002 | IGCM_debug_PushStack "IGCM_sys_FichWork" $@ |
---|
1003 | if ( $DEBUG_sys ) ; then |
---|
1004 | echo "IGCM_sys_GetDate_FichWork :" $@ |
---|
1005 | fi |
---|
1006 | # donne la date filesys d'un fichier sur la machine work |
---|
1007 | IGCM_debug_PopStack "IGCM_sys_FichWork" |
---|
1008 | } |
---|
1009 | |
---|
1010 | #D-#================================================== |
---|
1011 | #D-function IGCM_sys_GetDate_FichArchive |
---|
1012 | #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE |
---|
1013 | #D-* Examples: |
---|
1014 | #D- |
---|
1015 | function IGCM_sys_GetDate_FichArchive { |
---|
1016 | IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ |
---|
1017 | if ( $DEBUG_sys ) ; then |
---|
1018 | echo "IGCM_sys_GetDate_FichArchive :" $@ |
---|
1019 | fi |
---|
1020 | IGCM_debug_PopStack "IGCM_sys_FichArchive" |
---|
1021 | } |
---|
1022 | |
---|
1023 | ############################################################## |
---|
1024 | # REBUILD OPERATOR |
---|
1025 | |
---|
1026 | function IGCM_sys_rebuild { |
---|
1027 | IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ |
---|
1028 | if ( $DEBUG_sys ) ; then |
---|
1029 | echo "IGCM_sys_rebuild :" $@ |
---|
1030 | fi |
---|
1031 | rebuild -f -o $@ |
---|
1032 | if [ $? -gt 0 ] ; then |
---|
1033 | echo "IGCM_sys_rebuild : erreur ${@}." |
---|
1034 | IGCM_debug_Exit "rebuild" |
---|
1035 | fi |
---|
1036 | |
---|
1037 | IGCM_debug_PopStack "IGCM_sys_rebuild" |
---|
1038 | } |
---|
1039 | |
---|
1040 | ############################################################## |
---|
1041 | # NCO OPERATOR |
---|
1042 | |
---|
1043 | function IGCM_sys_ncap { |
---|
1044 | IGCM_debug_PushStack "IGCM_sys_ncap" -- $@ |
---|
1045 | if ( $DEBUG_sys ) ; then |
---|
1046 | echo "IGCM_sys_ncap :" $@ |
---|
1047 | fi |
---|
1048 | /usr/local/bin/ncap $@ |
---|
1049 | if [ $? -gt 0 ] ; then |
---|
1050 | echo "IGCM_sys_ncap : erreur ${@}." |
---|
1051 | # IGCM_debug_Exit "ncap" |
---|
1052 | fi |
---|
1053 | |
---|
1054 | IGCM_debug_PopStack "IGCM_sys_ncap" |
---|
1055 | } |
---|
1056 | |
---|
1057 | ncatted=/usr/local/bin/ncatted |
---|
1058 | # Problem with ksh and string passed in this function to ncatted ! |
---|
1059 | # function IGCM_sys_ncatted { |
---|
1060 | # IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ |
---|
1061 | # if ( $DEBUG_sys ) ; then |
---|
1062 | # echo "IGCM_sys_ncatted :" $@ |
---|
1063 | # fi |
---|
1064 | # /usr/local/bin/ncatted $@ |
---|
1065 | # if [ $? -gt 0 ] ; then |
---|
1066 | # echo "IGCM_sys_ncatted : erreur ${@}." |
---|
1067 | # IGCM_debug_Exit "ncatted" |
---|
1068 | # fi |
---|
1069 | |
---|
1070 | # IGCM_debug_PopStack "IGCM_sys_ncatted" |
---|
1071 | # } |
---|
1072 | |
---|
1073 | function IGCM_sys_ncbo { |
---|
1074 | IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ |
---|
1075 | if ( $DEBUG_sys ) ; then |
---|
1076 | echo "IGCM_sys_ncbo :" $@ |
---|
1077 | fi |
---|
1078 | /usr/local/bin/ncbo $@ |
---|
1079 | if [ $? -gt 0 ] ; then |
---|
1080 | echo "IGCM_sys_ncbo : erreur ${@}." |
---|
1081 | # IGCM_debug_Exit "ncbo" |
---|
1082 | fi |
---|
1083 | |
---|
1084 | IGCM_debug_PopStack "IGCM_sys_ncbo" |
---|
1085 | } |
---|
1086 | |
---|
1087 | function IGCM_sys_ncdiff { |
---|
1088 | IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ |
---|
1089 | if ( $DEBUG_sys ) ; then |
---|
1090 | echo "IGCM_sys_ncdiff :" $@ |
---|
1091 | fi |
---|
1092 | /usr/local/bin/ncdiff $@ |
---|
1093 | if [ $? -gt 0 ] ; then |
---|
1094 | echo "IGCM_sys_ncdiff : erreur ${@}." |
---|
1095 | # IGCM_debug_Exit "ncdiff" |
---|
1096 | fi |
---|
1097 | |
---|
1098 | IGCM_debug_PopStack "IGCM_sys_ncdiff" |
---|
1099 | } |
---|
1100 | |
---|
1101 | function IGCM_sys_ncea { |
---|
1102 | IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ |
---|
1103 | if ( $DEBUG_sys ) ; then |
---|
1104 | echo "IGCM_sys_ncea :" $@ |
---|
1105 | fi |
---|
1106 | /usr/local/bin/ncea $@ |
---|
1107 | if [ $? -gt 0 ] ; then |
---|
1108 | echo "IGCM_sys_ncea : erreur ${@}." |
---|
1109 | # IGCM_debug_Exit "ncea" |
---|
1110 | fi |
---|
1111 | |
---|
1112 | IGCM_debug_PopStack "IGCM_sys_ncea" |
---|
1113 | } |
---|
1114 | |
---|
1115 | function IGCM_sys_ncecat { |
---|
1116 | IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ |
---|
1117 | if ( $DEBUG_sys ) ; then |
---|
1118 | echo "IGCM_sys_ncecat :" $@ |
---|
1119 | fi |
---|
1120 | /usr/local/bin/ncecat $@ |
---|
1121 | if [ $? -gt 0 ] ; then |
---|
1122 | echo "IGCM_sys_ncecat : erreur ${@}." |
---|
1123 | # IGCM_debug_Exit "ncecat" |
---|
1124 | fi |
---|
1125 | |
---|
1126 | IGCM_debug_PopStack "IGCM_sys_ncecat" |
---|
1127 | } |
---|
1128 | |
---|
1129 | function IGCM_sys_ncflint { |
---|
1130 | IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ |
---|
1131 | if ( $DEBUG_sys ) ; then |
---|
1132 | echo "IGCM_sys_ncflint :" $@ |
---|
1133 | fi |
---|
1134 | /usr/local/bin/ncflint $@ |
---|
1135 | if [ $? -gt 0 ] ; then |
---|
1136 | echo "IGCM_sys_ncflint : erreur ${@}." |
---|
1137 | # IGCM_debug_Exit "ncflint" |
---|
1138 | fi |
---|
1139 | |
---|
1140 | IGCM_debug_PopStack "IGCM_sys_ncflint" |
---|
1141 | } |
---|
1142 | |
---|
1143 | function IGCM_sys_ncks { |
---|
1144 | IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ |
---|
1145 | if ( $DEBUG_sys ) ; then |
---|
1146 | echo "IGCM_sys_ncks :" $@ |
---|
1147 | fi |
---|
1148 | /usr/local/bin/ncks $@ |
---|
1149 | if [ $? -gt 0 ] ; then |
---|
1150 | echo "IGCM_sys_ncks : erreur ${@}." |
---|
1151 | # IGCM_debug_Exit "ncks" |
---|
1152 | fi |
---|
1153 | |
---|
1154 | IGCM_debug_PopStack "IGCM_sys_ncks" |
---|
1155 | } |
---|
1156 | |
---|
1157 | function IGCM_sys_ncpdq { |
---|
1158 | IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ |
---|
1159 | if ( $DEBUG_sys ) ; then |
---|
1160 | echo "IGCM_sys_ncpdq :" $@ |
---|
1161 | fi |
---|
1162 | /usr/local/bin/ncpdq $@ |
---|
1163 | if [ $? -gt 0 ] ; then |
---|
1164 | echo "IGCM_sys_ncpdq : erreur ${@}." |
---|
1165 | # IGCM_debug_Exit "ncpdq" |
---|
1166 | fi |
---|
1167 | |
---|
1168 | IGCM_debug_PopStack "IGCM_sys_ncpdq" |
---|
1169 | } |
---|
1170 | |
---|
1171 | function IGCM_sys_ncra { |
---|
1172 | IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ |
---|
1173 | if ( $DEBUG_sys ) ; then |
---|
1174 | echo "IGCM_sys_ncra :" $@ |
---|
1175 | fi |
---|
1176 | /usr/local/bin/ncra $@ |
---|
1177 | if [ $? -gt 0 ] ; then |
---|
1178 | echo "IGCM_sys_ncra : erreur ${@}." |
---|
1179 | # IGCM_debug_Exit "ncra" |
---|
1180 | fi |
---|
1181 | |
---|
1182 | IGCM_debug_PopStack "IGCM_sys_ncra" |
---|
1183 | } |
---|
1184 | |
---|
1185 | function IGCM_sys_ncrcat { |
---|
1186 | IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ |
---|
1187 | if ( $DEBUG_sys ) ; then |
---|
1188 | echo "IGCM_sys_ncrcat :" $@ |
---|
1189 | fi |
---|
1190 | /usr/local/bin/ncrcat $@ |
---|
1191 | if [ $? -gt 0 ] ; then |
---|
1192 | echo "IGCM_sys_ncrcat : erreur ${@}." |
---|
1193 | # IGCM_debug_Exit "ncrcat" |
---|
1194 | fi |
---|
1195 | |
---|
1196 | IGCM_debug_PopStack "IGCM_sys_ncrcat" |
---|
1197 | } |
---|
1198 | |
---|
1199 | function IGCM_sys_ncrename { |
---|
1200 | IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ |
---|
1201 | if ( $DEBUG_sys ) ; then |
---|
1202 | echo "IGCM_sys_ncrename :" $@ |
---|
1203 | fi |
---|
1204 | /usr/local/bin/ncrename $@ |
---|
1205 | if [ $? -gt 0 ] ; then |
---|
1206 | echo "IGCM_sys_ncrename : erreur ${@}." |
---|
1207 | # IGCM_debug_Exit "ncrename" |
---|
1208 | fi |
---|
1209 | |
---|
1210 | IGCM_debug_PopStack "IGCM_sys_ncrename" |
---|
1211 | } |
---|
1212 | |
---|
1213 | function IGCM_sys_ncwa { |
---|
1214 | IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ |
---|
1215 | if ( $DEBUG_sys ) ; then |
---|
1216 | echo "IGCM_sys_ncwa :" $@ |
---|
1217 | fi |
---|
1218 | /usr/local/bin/ncwa $@ |
---|
1219 | if [ $? -gt 0 ] ; then |
---|
1220 | echo "IGCM_sys_ncwa : erreur ${@}." |
---|
1221 | # IGCM_debug_Exit "ncwa" |
---|
1222 | fi |
---|
1223 | |
---|
1224 | IGCM_debug_PopStack "IGCM_sys_ncwa" |
---|
1225 | } |
---|
1226 | |
---|
1227 | ############################################################ |
---|
1228 | # Activate Running Environnment Variables |
---|
1229 | |
---|
1230 | function IGCM_sys_activ_variables { |
---|
1231 | IGCM_debug_PushStack "IGCM_sys_activ_variables" |
---|
1232 | if ( $DEBUG_sys ) ; then |
---|
1233 | echo "IGCM_sys_activ_variables" |
---|
1234 | fi |
---|
1235 | IGCM_debug_PopStack "IGCM_sys_activ_variables" |
---|
1236 | } |
---|
1237 | |
---|
1238 | ############################################################ |
---|
1239 | # Desactivate Running Environnment Variables |
---|
1240 | |
---|
1241 | function IGCM_sys_desactiv_variables { |
---|
1242 | IGCM_debug_PushStack "IGCM_sys_desactiv_variables" |
---|
1243 | if ( $DEBUG_sys ) ; then |
---|
1244 | echo "IGCM_sys_desactiv_variables" |
---|
1245 | fi |
---|
1246 | IGCM_debug_PopStack "IGCM_sys_desactiv_variables" |
---|
1247 | } |
---|
1248 | |
---|
1249 | ############################################################ |
---|
1250 | # Build run file |
---|
1251 | |
---|
1252 | function IGCM_sys_build_run_file { |
---|
1253 | IGCM_debug_PushStack "IGCM_sys_build_run_file" $@ |
---|
1254 | if ( $DEBUG_sys ) ; then |
---|
1255 | echo "IGCM_sys_build_run_file" $@ |
---|
1256 | fi |
---|
1257 | IGCM_debug_PopStack "IGCM_sys_build_run_file" |
---|
1258 | } |
---|