source: tags/libIGCM_v2.0_beta1/libIGCM_sys/libIGCM_sys_default.ksh @ 1435

Last change on this file since 1435 was 651, checked in by aclsce, 12 years ago

Added check to be sure there is enough space on temporary filesystems (only on vargas, titane and mercure sx9).
If there is not enough space, we stop.

  • 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.5 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    typeset ExistFlag
411    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
412    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
413
414    return ${ExistFlag}
415}
416
417#D-#==================================================
418#D-function IGCM_sys_CountFileArchive
419#D-* Purpose: Count files on Archive filesystem
420#D-* Examples:
421#D-
422function IGCM_sys_CountFileArchive {
423    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
424    ls ${@} 2>/dev/null | wc -l
425    if [ $? -gt 0 ] ; then
426        echo "IGCM_sys_CountFileArchive : erreur."
427    fi
428    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
429}
430
431#D-#==================================================
432#D-function IGCM_sys_Tree
433#D-* Purpose: Tree directories with files on ${ARCHIVE}
434#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
435#D-
436function IGCM_sys_Tree {
437    IGCM_debug_PushStack "IGCM_sys_Tree" $@
438    if ( $DEBUG_sys ) ; then
439        echo "IGCM_sys_Tree :" $@
440    fi
441
442    \tree -f $@
443
444    IGCM_debug_PopStack "IGCM_sys_Tree"
445}
446
447#D-#==================================================
448#D-function IGCM_sys_Tar
449#D-* Purpose: master un-tar command
450#D-* Examples:
451#D-
452function IGCM_sys_Tar {
453    IGCM_debug_PushStack "IGCM_sys_Tar" $@
454    if ( $DEBUG_sys ) ; then
455        echo "IGCM_sys_Tar :" $@
456    fi
457    \tar cvf $@
458    if [ $? -gt 0 ] ; then
459        echo "IGCM_sys_Tar : erreur."
460        IGCM_debug_Exit "IGCM_sys_Tar"
461    fi
462    \tar tvf $1
463
464    IGCM_debug_PopStack "IGCM_sys_Tar"
465}
466
467#D-#==================================================
468#D-function IGCM_sys_UnTar
469#D-* Purpose: master un-tar command
470#D-* Examples:
471#D-
472function IGCM_sys_UnTar {
473    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
474    if ( $DEBUG_sys ) ; then
475        echo "IGCM_sys_UnTar :" $@
476    fi
477    \tar xvf $1
478    if [ $? -gt 0 ] ; then
479        echo "IGCM_sys_UnTar : erreur."
480        IGCM_debug_Exit "IGCM_sys_UnTar"
481    fi
482    IGCM_debug_PopStack "IGCM_sys_UnTar"
483}
484
485#D-#==================================================
486#D-function IGCM_sys_Qsub
487#D-* Purpose: Qsub new job
488#D-* Examples:
489#D-
490function IGCM_sys_Qsub {
491    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
492    if ( $DEBUG_sys ) ; then
493        echo "IGCM_sys_Qsub :" $@
494    fi
495    echo "ssh -l ${LOGIN} ${HOST} ""cd ${SUBMIT_DIR} ; ${@}"" > ${Script_Output} 2>&1 &"
496    ssh -l ${LOGIN} ${HOST} "cd ${SUBMIT_DIR} ; ${@}" > ${Script_Output} 2>&1 &
497    if [ $? -gt 0 ] ; then
498        echo "IGCM_sys_Qsub : erreur."
499        IGCM_debug_Exit "IGCM_sys_Qsub"
500    fi
501    IGCM_debug_PopStack "IGCM_sys_Qsub"
502}
503
504#D-#==================================================
505#D-function IGCM_sys_QsubPost
506#D-* Purpose: Qsub new job on scalaire
507#D-* Examples:
508#D-
509function IGCM_sys_QsubPost {
510    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
511    if ( $DEBUG_sys ) ; then
512        echo "IGCM_sys_QsubPost :" $@
513    fi
514    #echo "ssh -x -l ${LOGIN} ${HOST} ${3} > ${2} 2>&1 &"
515    #    ssh -x -l ${LOGIN} ${HOST}
516    echo "${libIGCM_POST}/$1.job > ${POST_DIR}/$1.${PeriodDateEnd}.out 2>&1 &"
517    ${libIGCM_POST}/$1.job > ${POST_DIR}/${Script_Post_Output}.out 2>&1 &
518    #    ${3} > ${2} 2>&1 &
519    if [ $? -gt 0 ] ; then
520        echo "IGCM_sys_QsubPost : erreur " $@
521        IGCM_debug_Exit "IGCM_sys_QsubPost"
522    fi
523    IGCM_debug_PopStack "IGCM_sys_QsubPost"
524}
525
526#D-*************************
527#D- File transfer functions
528#D-*************************
529#D-
530
531#D-#==================================================
532#D-function IGCM_sys_Rsync_out
533#D-* Purpose: treat return val of rsync
534#D-* Examples:  IGCM_sys_Rsync_out out_RET_rsync
535#D-  Error values and explanations can depend on your system version.
536function IGCM_sys_Rsync_out {
537    RET=$1
538    if [ ! $RET ] ; then
539        echo "rsync error !"
540    fi
541
542    if [ $MYLANG = "fr" ]; then
543        case $RET in
544            0)  return ;;
545            1)  echo "Erreur de rsync ; RERR_SYNTAX : "
546                echo "Erreur de syntaxe ou d'utilisation."
547                return;;
548            2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
549                echo "Incompatibilité de protocole."
550                return;;
551            3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
552                echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
553                echo "répertoires"
554                return;;
555            4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
556                echo "Action demandée non supportée : une tentative de manipulation de"
557                echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
558                echo "été faite ; ou une option qui est supportée par le  client  mais"
559                echo "pas par le serveur a été spécifiée."
560                return;;
561            10) echo "Erreur de rsync ; RERR_SOCKETIO"
562                echo "Erreur dans le socket d'entrée sortie"
563                return;;
564            11) echo "Erreur de rsync ; RERR_FILEIO"
565                echo "Erreur d'entrée sortie fichier"
566                return;;
567            12) echo "Erreur de rsync ; RERR_STREAMIO"
568                echo "Erreur dans flux de donnée du protocole rsync"
569                return;;
570            13) echo "Erreur de rsync ; RERR_MESSAGEIO"
571                echo "Erreur avec les diagnostics du programme"
572                return;;
573            14) echo "Erreur de rsync ; RERR_IPC"
574                echo "Erreur dans le code IPC"
575                return;;
576            20) echo "Erreur de rsync ; RERR_SIGNAL"
577                echo "SIGUSR1 ou SIGINT reçu"
578                return;;
579            21) echo "Erreur de rsync ; RERR_WAITCHILD"
580                echo "Une erreur retournée par waitpid()"
581                return;;
582            22) echo "Erreur de rsync ; RERR_MALLOC"
583                echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
584                return;;
585            23) echo ""
586                echo "Erreur fichier inexistant"
587                return;;
588            30) echo "Erreur de rsync ; RERR_TIMEOUT"
589                echo "Temps d'attente écoulé dans l'envoi/réception de données"
590                return;;
591            *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
592                return;;
593        esac
594    elif [ $MYLANG = "en" ] ; then
595        case $RET in
596            0)  return;;               
597            1)  echo "rsync error : Syntax or usage error "
598                return;;
599            2)  echo "rsync error : Protocol incompatibility "
600                return;;
601            3)  echo "rsync error : Errors selecting input/output files, dirs"
602                return;;
603            4)  echo "rsync error : Requested action not supported: an attempt"
604                echo "was made to manipulate 64-bit files on a platform that cannot support"
605                echo "them; or an option was specified that is supported by the client and"
606                echo "not by the server."
607                return;;
608            5)  echo "rsync error : Error starting client-server protocol"
609                return;;
610            10) echo "rsync error : Error in socket I/O "
611                return;;
612            11) echo "rsync error : Error in file I/O "
613                return;;
614            12) echo "rsync error : Error in rsync protocol data stream "
615                return;;
616            13) echo "rsync error : Errors with program diagnostics "
617                return;;
618            14) echo "rsync error : Error in IPC code "
619                return;;
620            20) echo "rsync error : Received SIGUSR1 or SIGINT "
621                return;;
622            21) echo "rsync error : Some error returned by waitpid() "
623                return;;
624            22) echo "rsync error : Error allocating core memory buffers "
625                return;;
626            23) echo "rsync error : Partial transfer due to error"
627                return;;
628            24) echo "rsync error : Partial transfer due to vanished source files"
629                return;;
630            30) echo "rsync error : Timeout in data send/receive "
631                return;;
632            *)  echo "rsync error : return code of rsync unknown :" $RET
633                return;;
634        esac
635    else
636        echo "unknown language $MYLANG."
637        return
638    fi
639}
640   
641#D-#==================================================
642#D-function IGCM_sys_Cp
643#D-* Purpose: generic cp
644#D-* Examples:
645#D-
646function IGCM_sys_Cp {
647    IGCM_debug_PushStack "IGCM_sys_Cp" $@
648    if ( $DEBUG_sys ) ; then
649        echo "IGCM_sys_Cp :" $@
650    fi
651
652    typeset RET
653
654    echo cp --preserve=timestamps $@ > out_rsync 2>&1
655    \cp --preserve=timestamps $@ >> out_rsync 2>&1
656    RET=$?
657   
658    if [ ${RET} -gt 0 ] ; then
659         echo ""
660#       echo "IGCM_sys_Cp : error."
661#       cat out_rsync
662#       IGCM_debug_Exit "IGCM_sys_Cp"
663     else
664         \rm out_rsync
665    fi
666    IGCM_debug_PopStack "IGCM_sys_Cp"
667}
668
669#D-#==================================================
670#D-function IGCM_sys_Rm
671#D-* Purpose: generic rm
672#D-* Examples:
673#D-
674function IGCM_sys_Rm {
675    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
676    if ( $DEBUG_sys ) ; then
677        echo "IGCM_sys_Rm :" $@
678    fi
679
680    typeset RET
681
682    echo rm $@ > out_rsync 2>&1
683    \rm $@ >> out_rsync 2>&1
684    RET=$?
685   
686    if [ ${RET} -gt 0 ] ; then
687        echo "IGCM_sys_Rm : error."
688        cat out_rsync
689        IGCM_debug_Exit "IGCM_sys_Rm"
690    else
691        \rm out_rsync
692    fi
693    IGCM_debug_PopStack "IGCM_sys_Rm"
694}
695
696#D-#==================================================
697#D-function IGCM_sys_RmRunDir
698#D-* Purpose: rm tmpdir (dummy function most of the time batch
699#D-                      scheduler will do the job)
700#D-* Examples:
701#D-
702function IGCM_sys_RmRunDir {
703    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
704    if ( $DEBUG_sys ) ; then
705        echo "IGCM_sys_RmRunDir :" $@
706        echo "Dummy call, let the scheduler do that."
707#       IGCM_sys_Rm -rf ${RUN_DIR}
708    fi
709    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
710}
711
712#D-#==================================================
713#D-function IGCM_sys_Mv
714#D-* Purpose: generic move
715#D-* Examples:
716#D-
717function IGCM_sys_Mv {
718    IGCM_debug_PushStack "IGCM_sys_Mv" $@
719    if ( $DEBUG_sys ) ; then
720        echo "IGCM_sys_Mv :" $@
721    fi
722
723    if [ $DRYRUN = 0 ]; then
724
725        typeset RET
726           
727        echo mv $@ > out_rsync 2>&1
728        \mv $@ >> out_rsync 2>&1
729        RET=$?
730   
731        if [ ${RET} -gt 0 ] ; then
732            echo "IGCM_sys_Mv : error in mv."
733            cat out_rsync
734            IGCM_debug_Exit "IGCM_sys_Mv"
735        else
736            \rm out_rsync
737        fi
738    else
739        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
740    fi
741
742    IGCM_debug_PopStack "IGCM_sys_Mv"
743}
744
745#D-#==================================================
746#D-function IGCM_sys_Put_Dir
747#D-* Purpose: Copy a complete directory on $(ARCHIVE)
748#D-* Examples:
749#D-
750function IGCM_sys_Put_Dir {
751    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
752    if ( $DEBUG_sys ) ; then
753        echo "IGCM_sys_Put_Dir :" $@
754    fi
755    if [ $DRYRUN = 0 ]; then
756        if [ ! -d ${1} ] ; then
757            echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
758            IGCM_debug_PopStack "IGCM_sys_Put_Dir"
759            return
760        fi
761
762        typeset RET
763
764        # Only if we use rsync
765        #IGCM_sys_TestDirArchive $( dirname $2 )
766        #
767        #USUAL WAY
768        \cp -R $1 $2 > out_rsync 2>&1
769        RET=$?
770
771        if [ ${RET} -gt 0 ] ; then
772            echo "IGCM_sys_Put_Dir : error."
773            cat out_rsync
774            IGCM_debug_Exit "IGCM_sys_Put_Dir"
775        else
776            \rm out_rsync
777        fi
778    else
779        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
780    fi
781    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
782}
783
784#D-#==================================================
785#D-function IGCM_sys_Get_Dir
786#D-* Purpose: Copy a complete directory from $(ARCHIVE)
787#D-* Examples:
788#D-
789function IGCM_sys_Get_Dir {
790    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
791    if ( $DEBUG_sys ) ; then
792        echo "IGCM_sys_Get_Dir :" $@
793    fi
794    if [ $DRYRUN = 0 ]; then
795        if [ ! -d ${1} ] ; then
796            echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
797            IGCM_debug_PopStack "IGCM_sys_Get_Dir"
798            return
799        fi
800
801        typeset RET
802
803        #USUAL WAY
804        \cp -R $1 $2 > out_rsync 2>&1
805        RET=$?
806
807        if [ ${RET} -gt 0 ] ; then
808            echo "IGCM_sys_Get_Dir : error."
809            cat out_rsync
810            IGCM_debug_Exit "IGCM_sys_Get_Dir"
811        else
812            \rm out_rsync
813        fi
814    else
815        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
816    fi
817    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
818}
819
820#D-#==================================================
821#D-function IGCM_sys_Get_Master
822#D-* Purpose: Copy a complete directory from MASTER filesystem
823#D-* Examples:
824#D-
825function IGCM_sys_Get_Master {
826    IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
827    if ( $DEBUG_sys ) ; then
828        echo "IGCM_sys_Get_Master :" $@
829    fi
830    if [ $DRYRUN = 0 ]; then
831        if ( [ ! -d ${1} ] && [ ! -f ${1} ] ) ; then
832            echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
833            IGCM_debug_PopStack "IGCM_sys_Get_Master"
834            return
835        fi
836
837        typeset RET
838
839        #USUAL WAY
840        cp -R $1 $2 > out_rsync 2>&1
841        RET=$?
842
843        if [ ${RET} -gt 0 ] ; then
844            echo "IGCM_sys_Get_Master : error."
845            cat out_rsync
846            IGCM_debug_Exit "IGCM_sys_Get_Master"
847        else
848            \rm out_rsync
849        fi
850    else
851        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
852    fi
853    IGCM_debug_PopStack "IGCM_sys_Get_Master"
854}
855
856#D-#==================================================
857#D-function IGCM_sys_Put_Rest
858#D-* Purpose: Put computied restarts on $(ARCHIVE).
859#D-           File and target directory must exist.
860#D-* Examples:
861#D-
862function IGCM_sys_Put_Rest {
863    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
864    if ( $DEBUG_sys ) ; then
865        echo "IGCM_sys_Put_Rest :" $@
866    fi
867    if [ $DRYRUN = 0 ]; then
868
869        IGCM_sys_TestDirArchive $( dirname $2 )
870
871        if [ ! -f ${1} ] ; then
872            echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
873            IGCM_debug_Exit "IGCM_sys_Put_Rest"
874        fi
875        if [ X${JobType} = XRUN ] ; then
876            IGCM_sys_Chmod 444 ${1}
877        fi
878
879        typeset RET
880
881        echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
882        ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
883        RET=$?
884        IGCM_sys_Rsync_out $RET
885
886        ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
887        (( RET=RET+$? ))
888
889        if [ ${RET} -gt 0 ] ; then
890            echo "IGCM_sys_Put_Rest : error."
891            cat out_rsync
892            IGCM_debug_Exit "IGCM_sys_Put_Rest"
893        else
894            \rm out_rsync
895        fi
896    else
897        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
898    fi
899    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
900}
901
902#D-#==================================================
903#D-function IGCM_sys_Put_Out
904#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
905#D-* Examples:
906#D-
907function IGCM_sys_Put_Out {
908    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
909    if ( $DEBUG_sys ) ; then
910        echo "IGCM_sys_Put_Out :" $@
911    fi
912    if [ $DRYRUN = 0 ]; then
913        if [ -f ${1} ] ; then
914            if [ ! -d $( dirname $2 ) ] ; then
915                IGCM_sys_MkdirArchive $( dirname $2 )
916            fi
917        else
918            echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
919            IGCM_debug_PopStack "IGCM_sys_Put_Out"
920            return 1
921        fi
922
923        typeset RET
924        #
925        if [ X${JobType} = XRUN ] ; then
926            if [ X${3} = X ] ; then
927                IGCM_sys_Chmod 444 ${1}
928            fi
929        fi
930        #
931
932        echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
933        ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
934        RET=$?
935        IGCM_sys_Rsync_out $RET
936
937        ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
938        (( RET=RET+$? ))
939
940        if [ ${RET} -gt 0 ] ; then
941            echo "IGCM_sys_Put_Out : error."
942            cat out_rsync
943            IGCM_debug_Exit "IGCM_sys_Put_Out"
944        else
945            \rm out_rsync
946        fi
947    else
948        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
949    fi
950    IGCM_debug_PopStack "IGCM_sys_Put_Out"
951    return 0
952}
953
954#D-#==================================================
955#D-function IGCM_sys_Get
956#D-* Purpose: Get a file from ${ARCHIVE}
957#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
958#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
959function IGCM_sys_Get {
960    IGCM_debug_PushStack "IGCM_sys_Get" $@
961
962    typeset DEST RET dm_liste ifile target
963
964    if ( $DEBUG_sys ) ; then
965        echo "IGCM_sys_Get :" $@
966    fi
967    if [ $DRYRUN -le 2 ]; then
968        if [ X${1} = X'/l' ] ; then
969            # test if the first file is present in the old computation :
970            eval set +A dm_liste \${${2}}
971        else
972            dm_liste=${1}
973        fi
974        eval DEST=\${${#}}
975
976        # test if the (first) file is present in the old computation :
977        IGCM_sys_TestFileArchive ${dm_liste[0]}
978        RET=$?
979        if [ ${RET} -gt 0 ] ; then
980            echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
981            IGCM_debug_Exit "IGCM_sys_Get"
982            #return
983        fi
984
985        (( RET=0 ))
986        for target in ${dm_liste[*]} ; do
987          \cp ${target} ${DEST} >> out_rsync 2>&1
988          (( RET=RET+$? ))
989        done
990
991#       echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1
992#       ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1
993#       RET=$?
994#       IGCM_sys_Rsync_out $RET
995
996#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
997#       (( RET=RET+$? ))
998
999        if [ ${RET} -gt 0 ] ; then
1000            echo "IGCM_sys_Get : copy error."
1001            cat out_rsync
1002            IGCM_debug_Exit "IGCM_sys_Get"
1003        else
1004            \rm out_rsync
1005        fi
1006    else
1007        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
1008    fi
1009    IGCM_debug_PopStack "IGCM_sys_Get"
1010}
1011
1012#D-#==================================================
1013#D-function IGCM_sys_Dods_Rm
1014#D-* Purpose: Suppress files in /tmp/DODS for simulation of internet protocole.
1015#D-* Examples:
1016#D-
1017function IGCM_sys_Dods_Rm {
1018    if ( $DEBUG_sys ) ; then
1019        echo "IGCM_sys_Dods_Rm :" $@
1020    fi
1021    typeset RET
1022    RET=0
1023    if [ $DRYRUN = 0 ]; then
1024        if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
1025            echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
1026            echo "Nothing has been done."
1027            return
1028        fi
1029        IGCM_sys_Rm -Rf /tmp/DODS/${config_UserChoices_TagName}/${config_UserChoices_JobName}/${1}
1030        RET=$?
1031       
1032        if [ ${RET} -gt 0 ] ; then
1033            echo "IGCM_sys_Put_Dods : error."
1034            cat out_dods_rm
1035            IGCM_debug_Exit "IGCM_sys_Dods_Rm"
1036        else
1037            rm out_dods_rm
1038        fi
1039    else
1040        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
1041    fi
1042    return $RET
1043}
1044
1045
1046#D-#==================================================
1047#D-function IGCM_sys_Dods_Cp
1048#D-* Purpose: Copy from $(ARCHIVE) files to /tmp/DODS for simulation of internet protocole.
1049#D-* Examples:
1050#D-
1051function IGCM_sys_Dods_Cp {
1052    if ( $DEBUG_sys ) ; then
1053        echo "IGCM_sys_Dods_Cp :" $@
1054    fi
1055    typeset RET
1056    RET=0
1057    if [ $DRYRUN = 0 ]; then
1058        if [ ! -d ${R_SAVE}/${1} ] ; then
1059            echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
1060            echo "Nothing has been done."
1061            return
1062        fi
1063        #
1064        IGCM_sys_Mkdir /tmp/DODS/${config_UserChoices_TagName}/${config_UserChoices_JobName}
1065        IGCM_sys_Cp -Rp --parents ${1} /tmp/DODS/${config_UserChoices_TagName}/${config_UserChoices_JobName}
1066        RET=$?
1067       
1068        if [ ${RET} -gt 0 ] ; then
1069            echo "IGCM_sys_Dods_Cp : error."
1070            cat out_dods_cp
1071            IGCM_debug_Exit "IGCM_sys_Dods_Cp"
1072        else
1073            rm out_dods_cp
1074        fi
1075    else
1076        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
1077    fi
1078    return $RET
1079}
1080
1081#D-#==================================================
1082#D-function IGCM_sys_Put_Dods
1083#D-* Purpose: Put $(ARCHIVE) files on /tmp/DODS for simulation of internet protocole.
1084#D-* Examples:
1085#D-
1086function IGCM_sys_Put_Dods {
1087    IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
1088    if ( $DEBUG_sys ) ; then
1089        echo "IGCM_sys_Put_Dods :" $@
1090    fi
1091    if [ $DRYRUN = 0 ]; then
1092        if [ ! -d ${R_SAVE}/${1} ] ; then
1093            echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
1094            IGCM_debug_PopStack "IGCM_sys_Put_Dods"
1095            return
1096        fi
1097
1098        typeset RET
1099        #
1100        cd ${R_SAVE}
1101        IGCM_sys_Dods_Rm ${1}
1102        IGCM_sys_Dods_Cp ${1}
1103        RET=0
1104       
1105        if [ ${RET} -gt 0 ] ; then
1106            echo "IGCM_sys_Put_Dods : error."
1107            IGCM_debug_Exit "IGCM_sys_Put_Dods"
1108        fi
1109    else
1110        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
1111    fi
1112    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
1113}
1114
1115############################################################## A FINIR !!
1116
1117#D-#==================================================
1118#D-function IGCM_sys_GetDate_FichWork
1119#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
1120#D-* Examples:
1121#D-
1122function IGCM_sys_GetDate_FichWork {
1123    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
1124    if ( $DEBUG_sys ) ; then
1125        echo "IGCM_sys_GetDate_FichWork :" $@
1126    fi
1127    # donne la date filesys d'un fichier sur la machine work
1128    IGCM_debug_PopStack "IGCM_sys_FichWork"
1129}
1130
1131#D-#==================================================
1132#D-function IGCM_sys_GetDate_FichArchive
1133#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE
1134#D-* Examples:
1135#D-
1136function IGCM_sys_GetDate_FichArchive {
1137    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
1138    if ( $DEBUG_sys ) ; then
1139        echo "IGCM_sys_GetDate_FichArchive :" $@
1140    fi
1141    IGCM_debug_PopStack "IGCM_sys_FichArchive"
1142}
1143
1144##############################################################
1145# REBUILD OPERATOR
1146
1147function IGCM_sys_rebuild {
1148    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
1149    if ( $DEBUG_sys ) ; then
1150        echo "IGCM_sys_rebuild :" $@
1151    fi
1152    rebuild -f -o $@
1153    if [ $? -gt 0 ] ; then
1154       echo "IGCM_sys_rebuild : erreur ${@}."
1155       IGCM_debug_Exit "rebuild"
1156    fi
1157
1158    IGCM_debug_PopStack "IGCM_sys_rebuild"
1159}
1160
1161##############################################################
1162# NCO OPERATOR
1163
1164function IGCM_sys_ncap2 {
1165    IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@
1166    if ( $DEBUG_sys ) ; then
1167        echo "IGCM_sys_ncap2 :" $@
1168    fi
1169    /usr/local/bin/ncap2 "$@"
1170    if [ $? -gt 0 ] ; then
1171       echo "IGCM_sys_ncap2 : erreur ${@}."
1172       IGCM_debug_Exit "ncap2"
1173    fi
1174
1175    IGCM_debug_PopStack "IGCM_sys_ncap2"
1176}
1177
1178function IGCM_sys_ncatted {
1179    IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
1180    if ( $DEBUG_sys ) ; then
1181        echo "IGCM_sys_ncatted :" $@
1182    fi
1183    /usr/local/bin/ncatted "$@"
1184    if [ $? -gt 0 ] ; then
1185       echo "IGCM_sys_ncatted : erreur ${@}."
1186       IGCM_debug_Exit "ncatted"
1187    fi
1188
1189    IGCM_debug_PopStack "IGCM_sys_ncatted"
1190}
1191
1192function IGCM_sys_ncbo {
1193    IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
1194    if ( $DEBUG_sys ) ; then
1195        echo "IGCM_sys_ncbo :" $@
1196    fi
1197    /usr/local/bin/ncbo $@
1198    if [ $? -gt 0 ] ; then
1199       echo "IGCM_sys_ncbo : erreur ${@}."
1200       IGCM_debug_Exit "ncbo"
1201    fi
1202
1203    IGCM_debug_PopStack "IGCM_sys_ncbo"
1204}
1205
1206function IGCM_sys_ncdiff {
1207    IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
1208    if ( $DEBUG_sys ) ; then
1209        echo "IGCM_sys_ncdiff :" $@
1210    fi
1211    /usr/local/bin/ncdiff $@
1212    if [ $? -gt 0 ] ; then
1213       echo "IGCM_sys_ncdiff : erreur ${@}."
1214       IGCM_debug_Exit "ncdiff"
1215    fi
1216
1217    IGCM_debug_PopStack "IGCM_sys_ncdiff"
1218}
1219
1220function IGCM_sys_ncea {
1221    IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
1222    if ( $DEBUG_sys ) ; then
1223        echo "IGCM_sys_ncea :" $@
1224    fi
1225    /usr/local/bin/ncea $@
1226    if [ $? -gt 0 ] ; then
1227       echo "IGCM_sys_ncea : erreur ${@}."
1228       IGCM_debug_Exit "ncea"
1229    fi
1230
1231    IGCM_debug_PopStack "IGCM_sys_ncea"
1232}
1233
1234function IGCM_sys_ncecat {
1235    IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
1236    if ( $DEBUG_sys ) ; then
1237        echo "IGCM_sys_ncecat :" $@
1238    fi
1239    /usr/local/bin/ncecat $@
1240    if [ $? -gt 0 ] ; then
1241       echo "IGCM_sys_ncecat : erreur ${@}."
1242       IGCM_debug_Exit "ncecat"
1243    fi
1244
1245    IGCM_debug_PopStack "IGCM_sys_ncecat"
1246}
1247
1248function IGCM_sys_ncflint {
1249    IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
1250    if ( $DEBUG_sys ) ; then
1251        echo "IGCM_sys_ncflint :" $@
1252    fi
1253    /usr/local/bin/ncflint $@
1254    if [ $? -gt 0 ] ; then
1255       echo "IGCM_sys_ncflint : erreur ${@}."
1256       IGCM_debug_Exit "ncflint"
1257    fi
1258
1259    IGCM_debug_PopStack "IGCM_sys_ncflint"
1260}
1261
1262function IGCM_sys_ncks {
1263    IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
1264    if ( $DEBUG_sys ) ; then
1265        echo "IGCM_sys_ncks :" $@
1266    fi
1267    /usr/local/bin/ncks $@
1268    if [ $? -gt 0 ] ; then
1269       echo "IGCM_sys_ncks : erreur ${@}."
1270       IGCM_debug_Exit "ncks"
1271    fi
1272
1273    IGCM_debug_PopStack "IGCM_sys_ncks"
1274}
1275
1276function IGCM_sys_ncpdq {
1277    IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
1278    if ( $DEBUG_sys ) ; then
1279        echo "IGCM_sys_ncpdq :" $@
1280    fi
1281    /usr/local/bin/ncpdq $@
1282    if [ $? -gt 0 ] ; then
1283       echo "IGCM_sys_ncpdq : erreur ${@}."
1284       IGCM_debug_Exit "ncpdq"
1285    fi
1286
1287    IGCM_debug_PopStack "IGCM_sys_ncpdq"
1288}
1289
1290function IGCM_sys_ncra {
1291    IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
1292    if ( $DEBUG_sys ) ; then
1293        echo "IGCM_sys_ncra :" $@
1294    fi
1295    /usr/local/bin/ncra $@
1296    if [ $? -gt 0 ] ; then
1297       echo "IGCM_sys_ncra : erreur ${@}."
1298       IGCM_debug_Exit "ncra"
1299    fi
1300
1301    IGCM_debug_PopStack "IGCM_sys_ncra"
1302}
1303
1304function IGCM_sys_ncrcat {
1305    IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
1306    if ( $DEBUG_sys ) ; then
1307        echo "IGCM_sys_ncrcat :" $@
1308    fi
1309    /usr/local/bin/ncrcat $@
1310    if [ $? -gt 0 ] ; then
1311       echo "IGCM_sys_ncrcat : erreur ${@}."
1312#       IGCM_debug_Exit "ncrcat"
1313    fi
1314
1315    IGCM_debug_PopStack "IGCM_sys_ncrcat"
1316}
1317
1318function IGCM_sys_ncrename {
1319    IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
1320    if ( $DEBUG_sys ) ; then
1321        echo "IGCM_sys_ncrename :" $@
1322    fi
1323    /usr/local/bin/ncrename $@
1324    if [ $? -gt 0 ] ; then
1325       echo "IGCM_sys_ncrename : erreur ${@}."
1326       IGCM_debug_Exit "ncrename"
1327    fi
1328
1329    IGCM_debug_PopStack "IGCM_sys_ncrename"
1330}
1331
1332function IGCM_sys_ncwa {
1333    IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
1334    if ( $DEBUG_sys ) ; then
1335        echo "IGCM_sys_ncwa :" $@
1336    fi
1337    /usr/local/bin/ncwa $@
1338    if [ $? -gt 0 ] ; then
1339       echo "IGCM_sys_ncwa : erreur ${@}."
1340       IGCM_debug_Exit "ncwa"
1341    fi
1342
1343    IGCM_debug_PopStack "IGCM_sys_ncwa"
1344}
1345
1346##############################################################
1347# CDO OPERATOR
1348
1349function IGCM_sys_cdo {
1350    IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
1351
1352    \cdo $@
1353    if [ $? -gt 0 ] ; then
1354       echo "IGCM_sys_cdo : erreur ${@}."
1355       IGCM_debug_PopStack "IGCM_sys_cdo"
1356       return 1
1357    else
1358        IGCM_debug_PopStack "IGCM_sys_cdo"
1359        return 0
1360    fi
1361
1362    IGCM_debug_PopStack "IGCM_sys_cdo"
1363}
1364
1365############################################################
1366# Activate Running Environnment Variables
1367
1368function IGCM_sys_activ_variables {
1369    IGCM_debug_PushStack "IGCM_sys_activ_variables"
1370    if ( $DEBUG_sys ) ; then
1371        echo "IGCM_sys_activ_variables"
1372    fi
1373    IGCM_debug_PopStack "IGCM_sys_activ_variables"
1374}
1375
1376############################################################
1377# Desactivate Running Environnment Variables
1378
1379function IGCM_sys_desactiv_variables {
1380    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
1381    if ( $DEBUG_sys ) ; then
1382        echo "IGCM_sys_desactiv_variables"
1383    fi
1384    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
1385}
1386
1387############################################################
1388# Build run file
1389
1390function IGCM_sys_build_run_file {
1391    IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
1392    if ( $DEBUG_sys ) ; then
1393        echo "IGCM_sys_build_run_file" $@
1394    fi
1395    IGCM_debug_PopStack "IGCM_sys_build_run_file"
1396}
1397
1398############################################################
1399# Check of space available on temporary filesytems
1400function IGCM_sys_check_quota {
1401    IGCM_debug_PushStack "IGCM_sys_check_quota"
1402    if ( $DEBUG_sys ) ; then
1403        echo "IGCM_sys_check_quota"
1404    fi
1405    IGCM_debug_PopStack "IGCM_sys_check_quota"
1406}
Note: See TracBrowser for help on using the repository browser.