source: branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_default.ksh @ 559

Last change on this file since 559 was 463, checked in by mafoipsl, 13 years ago

Delete useless sleep.

  • Property licence set to
    The following licence information concerns ONLY the libIGCM tools
    ==================================================================

    Copyright © Centre National de la Recherche Scientifique CNRS
    Commissariat à l'Énergie Atomique CEA

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

    This library is a set of shell scripts and functions whose purpose is
    the management of the initialization, the launch, the transfer of
    output files, the post-processing and the monitoring of datas produce
    by any numerical program on any plateforme.

    This software is governed by the CeCILL license under French law and
    abiding by the rules of distribution of free software. You can use,
    modify and/ or redistribute the software under the terms of the CeCILL
    license as circulated by CEA, CNRS and INRIA at the following URL
    "http://www.cecill.info".

    As a counterpart to the access to the source code and rights to copy,
    modify and redistribute granted by the license, users are provided only
    with a limited warranty and the software's author, the holder of the
    economic rights, and the successive licensors have only limited
    liability.

    In this respect, the user's attention is drawn to the risks associated
    with loading, using, modifying and/or developing or reproducing the
    software by the user in light of its specific status of free software,
    that may mean that it is complicated to manipulate, and that also
    therefore means that it is reserved for developers and experienced
    professionals having in-depth computer knowledge. Users are therefore
    encouraged to load and test the software's suitability as regards their
    requirements in conditions enabling the security of their systems and/or
    data to be ensured and, more generally, to use and operate it in the
    same conditions as regards security.

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