source: tags/libIGCM_v1_7/libIGCM_sys/libIGCM_sys_default.ksh @ 1137

Last change on this file since 1137 was 308, checked in by mafoipsl, 14 years ago

Include changeset [305] into libIGCM_v1_7.

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