source: trunk/libIGCM/libIGCM_sys/libIGCM_sys_cesium.ksh @ 228

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

Supress buggy space after HOST and LOGIN variables.
Add an optionnal argument to all IGCM_sys_Put_Out functions :
if any 3thrd argument is there, file won't be protected. If
there is no argument (default in libIGCM), file will be set read-only.

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