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

Last change on this file since 345 was 345, checked in by mmaipsl, 14 years ago

I have forget a 'rm' command, sorry.

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