source: trunk/libIGCM/libIGCM_sys/libIGCM_sys_default.ksh @ 404

Last change on this file since 404 was 404, checked in by acosce, 13 years ago

Aco : add "\" before "rm out_rsync" to force the remove (without asking
befor removing the file)

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