source: trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh @ 637

Last change on this file since 637 was 536, checked in by mmaipsl, 12 years ago

Correct IGCM_sys_GetDate_FichWork and some IGCM_sys_Tar. Suppress DODS for obelix. Add IGCM_sys_RshMaster to connect to frontend.

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