source: tags/libIGCM_v1_9/libIGCM_sys/libIGCM_sys_obelix.ksh @ 1170

Last change on this file since 1170 was 347, checked in by mmaipsl, 14 years ago

Add possibility to change ARCHIVE directory on obelix.

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