source: trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh @ 404

Last change on this file since 404 was 404, checked in by acosce, 13 years ago

Aco : add "\" before "rm out_rsync" to force the remove (without asking
befor removing the file)

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