source: tags/libIGCM_v1_4/libIGCM_sys/libIGCM_sys_default.ksh

Last change on this file was 173, checked in by mafoipsl, 15 years ago

Add DRYRUN capability in Sys_Mv for all systems supported.

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