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