source: tags/libIGCM_v1_7/libIGCM_sys/libIGCM_sys_obelix.ksh @ 302

Last change on this file since 302 was 288, checked in by mafoipsl, 14 years ago

Add SUBLIT_DIR in messgae snt at the end of each simulation. Complete messages in clean_month.

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