source: trunk/libIGCM/libIGCM_sys/libIGCM_sys_cesium.ksh @ 348

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

Suppress test on dods_cp return code because it is always positive.

  • Property svn:keywords set to Date Author Revision
File size: 39.7 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Sebastien Denvil, Martial Mancip
5# Contact: Martial.Mancip_ipsl.jussieu.fr
6# $Date$
7# $Author$
8# $Revision$
9# IPSL (2006)
10#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
11# History:
12# Modification:
13#
14#**************************************************************
15
16#=========================================================
17# The documentation of this file can be automatically generated
18# if you use the prefix #D- for comments to be extracted.
19# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
20#=========================================================
21
22#D-#==================================================
23#D-LibIGCM_sys for Cesium
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# ie storage filesystem
82typeset -r RHOST=cesium
83
84#====================================================
85# Source default environment
86#====================================================
87. /etc/profile
88
89#====================================================
90# Set environment tools (ferret, nco, cdo)
91#====================================================
92. /home/cont003/p86ipsl/.atlas_env_cesium_ksh
93
94#====================================================
95# Specific for ocean additionnal diagnostic
96export FER_GO="$FER_GO /home/cont003/p86denv/IGCM_POST_UTIL/JNL /home/cont003/p86denv/GRAF /home/cont003/p86denv/GRAF/GO"
97export FER_PALETTE="$FER_PALETTE /home/cont003/p86denv/GRAF/PALET"
98
99#====================================================
100# Host specific DIRECTORIES
101#====================================================
102
103#====================================================
104#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
105typeset -r R_EXE="${MODIPSL}/bin"
106
107#====================================================
108# For interactive jobs on cesium
109PBS_O_WORKDIR=${PBS_O_WORKDIR:=$(pwd)}
110
111#====================================================
112#- SUBMIT_DIR : submission dir
113typeset SUBMIT_DIR=${SUBMIT_DIR:=${PBS_O_WORKDIR}}
114
115#====================================================
116#- ARCHIVE
117typeset -r ARCHIVE=${DMFDIR}
118
119#====================================================
120#- IN
121typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
122
123#====================================================
124#- OUT
125typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
126
127#====================================================
128#- OUT_SCR (ONLY FOR double copy an scratch)
129typeset -r R_OUT_SCR=${SCRATCHDIR}/IGCM_OUT
130
131#====================================================
132#- OUT_POST
133typeset -r R_OUT_POST=${SCRATCHDIR}/IGCM_OUT
134
135#====================================================
136#- RUN_DIR_PATH : Temporary working directory (=> TMP)
137PBS_JOBID=${PBS_JOBID:=TEMPDIR$$}
138typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/${PBS_JOBID}}
139
140#====================================================
141#- Max number of arguments passed to nco operator or demigration command
142UNIX_MAX_LIMIT=360
143
144#D-#==================================================
145#D-function IGCM_sys_RshMaster
146#D-* Purpose: Just a fake command to wrapp
147#D-           IGCM_card call in post-treatment
148#D-           Ulam do not see brodie filesystem
149#D-           Cesium do not see all mercure filesystem
150#D-           That's why we need this hack.
151#D-* Examples:
152#D-
153function IGCM_sys_RshMaster {
154    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
155    ssh ${MASTER} exec /bin/ksh <<-EOF
156    export libIGCM=${libIGCM_SX}
157    export DEBUG_debug=${DEBUG_debug}
158    . ${libIGCM_SX}/libIGCM_debug/libIGCM_debug.ksh
159    . ${libIGCM_SX}/libIGCM_card/libIGCM_card.ksh
160    ${@}
161EOF
162    if [ $? -gt 0 ] ; then
163        echo "IGCM_sys_RshMaster : erreur."
164        IGCM_debug_Exit "IGCM_sys_RshMaster"
165    fi
166    IGCM_debug_PopStack "IGCM_sys_RshMaster"
167}
168
169#D-#==================================================
170#D-function IGCM_sys_RshArchive
171#D-* Purpose: Archive rsh command
172#D-* Examples:
173#D-
174function IGCM_sys_RshArchive {
175    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
176    /bin/ksh <<-EOF
177    ${@}
178EOF
179    if [ $? -gt 0 ] ; then
180        echo "IGCM_sys_RshArchive : erreur."
181        IGCM_debug_Exit "IGCM_sys_RshArchive"
182    fi
183    IGCM_debug_PopStack "IGCM_sys_RshArchive"
184}
185
186#D-#==================================================
187#D-function IGCM_sys_RshPost
188#D-* Purpose: Post-process rsh command
189#D-* Examples:
190#D-
191function IGCM_sys_RshPost {
192    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
193    if ( $DEBUG_sys ) ; then
194        echo "IGCM_sys_RshPost :" $@
195    fi
196    /bin/ksh ${@}
197    if [ $? -gt 0 ] ; then
198        echo "IGCM_sys_RshPost : erreur."
199        IGCM_debug_Exit "IGCM_sys_RshPost"
200    fi
201    IGCM_debug_PopStack "IGCM_sys_RshPost"
202}
203
204#D-#==================================================
205#D-function IGCM_sys_SendMail
206#D-* Purpose: Send mail when simulation is over
207#D-* Examples:
208#D-
209function IGCM_sys_SendMail {
210    IGCM_debug_PushStack "IGCM_sys_SendMailPost" $@
211    if ( $DEBUG_sys ) ; then
212        echo "IGCM_sys_SendMail :" $@
213    fi
214
215    IGCM_sys_RshPost <<-EOF
216    export LOGIN=${LOGIN}
217    export config_UserChoices_JobName=${config_UserChoices_JobName}
218    export config_UserChoices_MailName=${config_UserChoices_MailName}
219    export DateBegin=${DateBegin}
220    export DateEnd=${DateEnd}
221    export R_SAVE=${R_SAVE}
222    export SUBMIT_DIR=${SUBMIT_DIR}
223
224    cat  << END_MAIL > job_end.mail
225Dear ${LOGIN},
226
227  Simulation ${config_UserChoices_JobName} is finished on supercomputer `hostname`.
228  Job started : ${DateBegin}
229  Job ended   : ${DateEnd}
230  Ouput files are available in ${R_SAVE}
231  Script files and Script Outputs are available in ${SUBMIT_DIR}
232END_MAIL
233
234    if [ ! -z ${config_UserChoices_MailName} ] ; then
235       mailx -s "${config_UserChoices_JobName} completed" ${config_UserChoices_MailName} <  job_end.mail
236    elif [ -f ~/.forward ] ; then
237       mailx -s "${config_UserChoices_JobName} completed" $( cat ~/.forward ) < job_end.mail
238    fi
239
240    sleep 10
241    rm -f job_end.mail
242EOF
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/ccc_msub -o ${Script_Output} -e ${Script_Output}.e < $1
506    if [ $? -gt 0 ] ; then
507        echo "IGCM_sys_Qsub : erreur  -o ${Script_Output} -e ${Script_Output}.e $@"
508        IGCM_debug_Exit "IGCM_sys_Qsub"
509    fi
510    IGCM_debug_PopStack "IGCM_sys_Qsub"
511}
512
513#D-#==================================================
514#D-function IGCM_sys_QsubPost
515#D-* Purpose: Qsub new job on scalaire
516#D-* Examples:
517#D-
518function IGCM_sys_QsubPost {
519    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
520    if ( $DEBUG_sys ) ; then
521        echo "IGCM_sys_QsubPost :" $@
522    fi
523    /usr/local/bin/ccc_msub -o ${POST_DIR}/$1.${PeriodDateEnd}.${TsTask}.${CompToRead}.${FlagToRead}.out -e ${POST_DIR}/$1.${PeriodDateEnd}.${TsTask}.${CompToRead}.${FlagToRead}.e.out -E "-v ${listVarEnv}" ${libIGCM}/$1.job
524    if [ $? -gt 0 ] ; then
525        echo "IGCM_sys_QsubPost : erreur " $@
526        IGCM_debug_Exit "IGCM_sys_QsubPost"
527    fi
528    IGCM_debug_PopStack "IGCM_sys_QsubPost"
529}
530
531#D-*************************
532#D- File transfer functions
533#D-*************************
534#D-
535
536#D-#==================================================
537#D-function IGCM_sys_Rsync_out
538#D-* Purpose: treat return val of rsync
539#D-* Examples: IGCM_sys_Rsync_out out_RET_rsync
540#D-  Error values and explanations can depend on your system version.
541function IGCM_sys_Rsync_out {
542    RET=$1
543    if [ ! $RET ] ; then
544        echo "rsync error !"
545    fi
546
547    if [ $MYLANG = "fr" ]; then
548        case $RET in
549            0)  return ;;
550            1)  echo "Erreur de rsync ; RERR_SYNTAX : "
551                echo "Erreur de syntaxe ou d'utilisation."
552                return;;
553            2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
554                echo "Incompatibilité de protocole."
555                return;;
556            3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
557                echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
558                echo "répertoires"
559                return;;
560            4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
561                echo "Action demandée non supportée : une tentative de manipulation de"
562                echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
563                echo "été faite ; ou une option qui est supportée par le  client  mais"
564                echo "pas par le serveur a été spécifiée."
565                return;;
566            10) echo "Erreur de rsync ; RERR_SOCKETIO"
567                echo "Erreur dans le socket d'entrée sortie"
568                return;;
569            11) echo "Erreur de rsync ; RERR_FILEIO"
570                echo "Erreur d'entrée sortie fichier"
571                return;;
572            12) echo "Erreur de rsync ; RERR_STREAMIO"
573                echo "Erreur dans flux de donnée du protocole rsync"
574                return;;
575            13) echo "Erreur de rsync ; RERR_MESSAGEIO"
576                echo "Erreur avec les diagnostics du programme"
577                return;;
578            14) echo "Erreur de rsync ; RERR_IPC"
579                echo "Erreur dans le code IPC"
580                return;;
581            20) echo "Erreur de rsync ; RERR_SIGNAL"
582                echo "SIGUSR1 ou SIGINT reçu"
583                return;;
584            21) echo "Erreur de rsync ; RERR_WAITCHILD"
585                echo "Une erreur retournée par waitpid()"
586                return;;
587            22) echo "Erreur de rsync ; RERR_MALLOC"
588                echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
589                return;;
590            23) echo ""
591                echo "Erreur fichier inexistant"
592                return;;
593            30) echo "Erreur de rsync ; RERR_TIMEOUT"
594                echo "Temps d'attente écoulé dans l'envoi/réception de données"
595                return;;
596            *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
597                return;;
598        esac
599    elif [ $MYLANG = "en" ] ; then
600        case $RET in
601            0)  return;;               
602            1)  echo "rsync error : Syntax or usage error "
603                return;;
604            2)  echo "rsync error : Protocol incompatibility "
605                return;;
606            3)  echo "rsync error : Errors selecting input/output files, dirs"
607                return;;
608            4)  echo "rsync error : Requested action not supported: an attempt"
609                echo "was made to manipulate 64-bit files on a platform that cannot support"
610                echo "them; or an option was specified that is supported by the client and"
611                echo "not by the server."
612                return;;
613            5)  echo "rsync error : Error starting client-server protocol"
614                return;;
615            10) echo "rsync error : Error in socket I/O "
616                return;;
617            11) echo "rsync error : Error in file I/O "
618                return;;
619            12) echo "rsync error : Error in rsync protocol data stream "
620                return;;
621            13) echo "rsync error : Errors with program diagnostics "
622                return;;
623            14) echo "rsync error : Error in IPC code "
624                return;;
625            20) echo "rsync error : Received SIGUSR1 or SIGINT "
626                return;;
627            21) echo "rsync error : Some error returned by waitpid() "
628                return;;
629            22) echo "rsync error : Error allocating core memory buffers "
630                return;;
631            23) echo "rsync error : Partial transfer due to error"
632                return;;
633            24) echo "rsync error : Partial transfer due to vanished source files"
634                return;;
635            30) echo "rsync error : Timeout in data send/receive "
636                return;;
637            *)  echo "rsync error : return code of rsync unknown :" $RET
638                return;;
639        esac
640    else
641        echo "unknown language $MYLANG."
642        return
643    fi
644}
645   
646#D-#==================================================
647#D-function IGCM_sys_Cp
648#D-* Purpose: generic cp
649#D-* Examples:
650#D-
651function IGCM_sys_Cp {
652    IGCM_debug_PushStack "IGCM_sys_Cp" $@
653    if ( $DEBUG_sys ) ; then
654        echo "IGCM_sys_Cp :" $@
655    fi
656
657    typeset RET
658
659    echo cp $@ > out_rsync 2>&1
660    \cp $@ >> out_rsync 2>&1
661    RET=$?
662
663    if [ ${RET} -gt 0 ] ; then
664        echo "IGCM_sys_Cp : error."
665        cat out_rsync
666        IGCM_debug_Exit "IGCM_sys_Cp"
667     else
668         rm out_rsync
669    fi
670    IGCM_debug_PopStack "IGCM_sys_Cp"
671}
672
673#D-#==================================================
674#D-function IGCM_sys_Rm
675#D-* Purpose: generic rm
676#D-* Examples:
677#D-
678function IGCM_sys_Rm {
679    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
680    if ( $DEBUG_sys ) ; then
681        echo "IGCM_sys_Rm :" $@
682    fi
683
684    typeset RET
685
686    echo rm $@ > out_rsync 2>&1
687    \rm $@ >> out_rsync 2>&1
688    RET=$?
689
690    if [ ${RET} -gt 0 ] ; then
691        echo "IGCM_sys_Rm : error."
692        cat out_rsync
693        IGCM_debug_Exit "IGCM_sys_Rm"
694    else
695        rm out_rsync
696    fi
697    IGCM_debug_PopStack "IGCM_sys_Rm"
698}
699
700#D-#==================================================
701#D-function IGCM_sys_RmRunDir
702#D-* Purpose: rm tmpdir (dummy function most of the time batch
703#D-                      scheduler will do the job)
704#D-* Examples:
705#D-
706function IGCM_sys_RmRunDir {
707    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
708    if ( $DEBUG_sys ) ; then
709        echo "IGCM_sys_RmRunDir :" $@
710    fi
711
712    typeset RET
713
714    echo rm $@ > out_rsync 2>&1
715    \rm $@ >> out_rsync 2>&1
716    RET=$?
717
718    if [ ${RET} -gt 0 ] ; then
719        echo "IGCM_sys_RmRunDir : error."
720        cat out_rsync
721        IGCM_debug_Exit "IGCM_sys_RmRunDir"
722    else
723        rm out_rsync
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        # Only if we use rsync
821        #IGCM_sys_TestDirArchive $( dirname $2 )
822        #
823        #USUAL WAY
824        \cp -r $1 $2 > out_rsync 2>&1
825        RET=$?
826
827        if [ ${RET} -gt 0 ] ; then
828            echo "IGCM_sys_Get_Dir : error."
829            cat out_rsync
830            IGCM_debug_Exit "IGCM_sys_Get_Dir"
831        else
832            rm out_rsync
833        fi
834    else
835        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
836    fi
837    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
838}
839
840#D-#==================================================
841#D-function IGCM_sys_Get_Master
842#D-* Purpose: Copy a complete directory from MASTER filesystem
843#D-* Examples:
844#D-
845function IGCM_sys_Get_Master {
846    IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
847    if ( $DEBUG_sys ) ; then
848        echo "IGCM_sys_Get_Master :" $@
849    fi
850    if [ $DRYRUN = 0 ]; then
851        TEST=$( IGCM_sys_RshMaster [ -d $1 ] && echo 1 || echo 0 )
852        if [ ${TEST} -ne 1 ] ; then
853            echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ON ${MASTER}."
854            IGCM_debug_PopStack "IGCM_sys_Get_Master"
855            return
856        fi
857
858        typeset RET
859        sleep 60
860
861        #USUAL WAY
862        scp -r ${MASTER}:$1 $2 > out_rsync 2>&1
863        RET=$?
864
865        if [ ${RET} -gt 0 ] ; then
866            echo "IGCM_sys_Get_Master : error."
867            cat out_rsync
868            IGCM_debug_Exit "IGCM_sys_Get_Master"
869        else
870            rm out_rsync
871        fi
872    else
873        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
874    fi
875    IGCM_debug_PopStack "IGCM_sys_Get_Master"
876}
877
878#D-#==================================================
879#D-function IGCM_sys_Put_Rest
880#D-* Purpose: Put computied restarts on $(ARCHIVE).
881#D-           File and target directory must exist.
882#D-* Examples:
883#D-
884function IGCM_sys_Put_Rest {
885    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
886    if ( $DEBUG_sys ) ; then
887        echo "IGCM_sys_Put_Rest :" $@
888    fi
889    if [ $DRYRUN = 0 ]; then
890        if [ ! -f ${1} ] ; then
891            echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
892            IGCM_debug_Exit "IGCM_sys_Put_Rest"
893        fi
894
895        typeset RET
896        #
897        if [ X${JobType} = XRUN ] ; then
898            IGCM_sys_Chmod 444 ${1}
899        fi
900        #
901        IGCM_sys_TestDirArchive $( dirname $2 )
902        #
903        # USUAL WAY
904        \cp $1 $2 > out_rsync 2>&1
905        RET=$?
906
907#       #RSYNC WITH NETWORK SSH CALL
908#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
909#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
910
911#       #RSYNC WITH NFS USE
912#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
913#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
914
915#       RET=$?
916#       IGCM_sys_Rsync_out $RET
917
918#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
919#       (( RET=RET+$? ))
920
921        if [ ${RET} -gt 0 ] ; then
922            echo "IGCM_sys_Put_Rest : error."
923            cat out_rsync
924            IGCM_debug_Exit "IGCM_sys_Put_Rest"
925        else
926            rm out_rsync
927        fi
928    else
929        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
930    fi
931    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
932}
933
934#D-#==================================================
935#D-function IGCM_sys_Put_Out
936#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
937#D-* Examples:
938#D-
939function IGCM_sys_Put_Out {
940    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
941    if ( $DEBUG_sys ) ; then
942        echo "IGCM_sys_Put_Out :" $@
943    fi
944    if [ $DRYRUN = 0 ]; then
945        if [ ! -f ${1} ] ; then
946            echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
947            IGCM_debug_PopStack "IGCM_sys_Put_Out"
948            return 1
949        fi
950        #
951        IGCM_sys_MkdirArchive $( dirname $2 )
952        #
953        typeset RET
954
955        #=====================================================
956        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
957        #=====================================================
958
959        #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1
960        #if [ $? -eq 0 ] ; then
961        #    typeset WORKPATH FILEPATH
962        #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )
963        #    IGCM_sys_MkdirWork ${WORKPATH}
964        #    FILEPATH=${WORKPATH}/$( basename $2 )
965        #    #
966        #    IGCM_sys_Cp ${1} ${FILEPATH}
967        #fi
968
969        if [ X${JobType} = XRUN ] ; then
970            if [ X${3} = X ] ; then
971                IGCM_sys_Chmod 444 ${1}
972            fi
973        fi
974        #
975        # USUAL WAY
976        cp $1 $2 > out_rsync 2>&1
977        RET=$?
978
979#       #RSYNC WITH NETWORK RSH CALL
980#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
981#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
982
983#       #RSYNC WITH NFS USE
984#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
985#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
986
987#       RET=$?
988#       IGCM_sys_Rsync_out $RET
989
990#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
991#       (( RET=RET+$? ))
992
993        if [ ${RET} -gt 0 ] ; then
994            echo "IGCM_sys_Put_Out : error."
995            cat out_rsync
996            IGCM_debug_Exit "IGCM_sys_Put_Out"
997        else
998            rm out_rsync
999        fi
1000    else
1001        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
1002    fi
1003    IGCM_debug_PopStack "IGCM_sys_Put_Out"
1004    return 0
1005}
1006
1007#D-#==================================================
1008#D-function IGCM_sys_Get
1009#D-* Purpose: Get a file from ${ARCHIVE}
1010#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
1011#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
1012function IGCM_sys_Get {
1013    IGCM_debug_PushStack "IGCM_sys_Get" $@
1014
1015    typeset DEST RET dm_liste ifile target file_work
1016
1017    if ( $DEBUG_sys ) ; then
1018        echo "IGCM_sys_Get :" $@
1019    fi
1020    if [ $DRYRUN -le 2 ]; then
1021        if [ X${1} = X'/l' ] ; then
1022            # test if the first file is present in the old computation :
1023            eval set +A dm_liste \${${2}}
1024        else
1025            eval set +A dm_liste ${1}
1026        fi
1027        eval DEST=\${${#}}
1028
1029        #=====================================================
1030        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
1031        #=====================================================
1032
1033        # Is it an R_OUT file (not R_IN) ?
1034        #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
1035        #if [ $? -eq 0 ] ; then
1036        #    # Yes  ? then we try to get it in SCRATCHDIR
1037        #    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|g" )
1038        #    if [ -f ${file_work[0]} ] ; then
1039        #       IGCM_sys_Cp ${file_work[*]} ${DEST}
1040        #       IGCM_debug_PopStack "IGCM_sys_Get"
1041        #       return
1042        #    fi
1043        #fi
1044
1045        # test if the (first) file is present in the old computation :
1046        IGCM_sys_TestFileArchive ${dm_liste[0]}
1047        RET=$?
1048        if [ ${RET} -gt 0 ] ; then
1049            echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
1050            IGCM_debug_Exit "IGCM_sys_Get"
1051            #IGCM_debug_PopStack "IGCM_sys_Get"
1052            #return
1053        fi
1054
1055        dmget ${dm_liste[*]} > out_rsync 2>&1
1056        RET=$?
1057        if [ ${RET} -gt 0 ] ; then
1058            echo "WARNING IGCM_sys_Get : demigration error."
1059            cat out_rsync
1060            #IGCM_debug_Exit "IGCM_sys_Get"
1061            #IGCM_debug_PopStack "IGCM_sys_Get"
1062            #return
1063        fi
1064
1065        #USUAL WAY
1066        (( RET=0 ))
1067        if [ X${1} = X'/l' ] ; then
1068            (( RET=0 ))
1069            for target in ${dm_liste[*]} ; do
1070                local_file=$( basename ${target} )
1071                \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
1072                (( RET = RET + $? ))
1073            done
1074        else
1075            \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
1076            RET=$?
1077        fi
1078
1079#       #RSYNC WITH NETWORK SSH CALL
1080#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
1081#       ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
1082
1083#       #RSYNC WITH NFS USE
1084#       echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
1085#       ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1
1086
1087#       RET=$?
1088#       IGCM_sys_Rsync_out $RET
1089
1090#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
1091#       (( RET=RET+$? ))
1092
1093        if [ ${RET} -gt 0 ] ; then
1094            echo "IGCM_sys_Get : copy error."
1095            cat out_rsync
1096            IGCM_debug_Exit "IGCM_sys_Get"
1097        else
1098            rm out_rsync
1099        fi
1100    else
1101        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
1102    fi
1103    IGCM_debug_PopStack "IGCM_sys_Get"
1104}
1105
1106#D-#==================================================
1107#D-function IGCM_sys_Dods_Rm
1108#D-* Purpose: DO NOTHING ! Put $(ARCHIVE) files on DODS internet protocole.
1109#D-* Examples:
1110#D-
1111function IGCM_sys_Dods_Rm {
1112    if ( $DEBUG_sys ) ; then
1113        echo "IGCM_sys_Dods_Rm :" $@
1114    fi
1115    typeset RET
1116    RET=0
1117    if [ $DRYRUN = 0 ]; then
1118        if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
1119            echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
1120            echo "Nothing has been done."
1121            return
1122        fi
1123        dods_rm public/${LOGIN}/${R_DODS}/${1} > out_dods_rm 2>&1
1124        RET=$?
1125       
1126        if [ ${RET} -gt 0 ] ; then
1127            echo "IGCM_sys_Dods_Rm : error."
1128            cat out_dods_rm
1129            IGCM_debug_Exit "IGCM_sys_Dods_Rm"
1130        else
1131            rm out_dods_rm
1132        fi
1133    else
1134        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
1135    fi
1136    return $RET
1137}
1138
1139
1140#D-#==================================================
1141#D-function IGCM_sys_Dods_Cp
1142#D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole.
1143#D-* Examples:
1144#D-
1145function IGCM_sys_Dods_Cp {
1146    if ( $DEBUG_sys ) ; then
1147        echo "IGCM_sys_Dods_Cp :" $@
1148    fi
1149    typeset RET
1150    RET=0
1151    if [ $DRYRUN = 0 ]; then
1152        if [ ! -d ${R_SAVE}/${1} ] ; then
1153            echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
1154            echo "Nothing has been done."
1155            return
1156        fi
1157        #
1158        dods_cp ${1} public/${LOGIN}/${R_DODS}
1159# > out_dods_cp 2>&1
1160        RET=$?
1161       
1162#       if [ ${RET} -gt 0 ] ; then
1163#           echo "IGCM_sys_Dods_Cp : error."
1164#           cat out_dods_cp
1165#           IGCM_debug_Exit "IGCM_sys_Dods_Cp"
1166#       else
1167#           rm out_dods_cp
1168#       fi
1169    else
1170        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
1171    fi
1172    return $RET
1173}
1174
1175#D-#==================================================
1176#D-function IGCM_sys_Put_Dods
1177#D-* Purpose: Put $(ARCHIVE) files on DODS internet protocole.
1178#D-* Examples:
1179#D-
1180function IGCM_sys_Put_Dods {
1181    IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
1182    if ( $DEBUG_sys ) ; then
1183        echo "IGCM_sys_Put_Dods :" $@
1184    fi
1185    if [ $DRYRUN = 0 ]; then
1186        if [ ! -d ${R_SAVE}/${1} ] ; then
1187            echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
1188            IGCM_debug_PopStack "IGCM_sys_Put_Dods"
1189            return
1190        fi
1191
1192        typeset RET
1193        #
1194        cd ${R_SAVE}
1195        IGCM_sys_Dods_Rm ${1}
1196        IGCM_sys_Dods_Cp ${1}
1197        RET=0
1198       
1199        if [ ${RET} -gt 0 ] ; then
1200            echo "IGCM_sys_Put_Dods : error."
1201            IGCM_debug_Exit "IGCM_sys_Put_Dods"
1202        fi
1203    else
1204        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
1205    fi
1206    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
1207}
1208
1209############################################################## A FINIR !!
1210
1211#D-#==================================================
1212#D-function IGCM_sys_GetDate_FichWork
1213#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
1214#D-* Examples:
1215#D-
1216function IGCM_sys_GetDate_FichWork {
1217    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
1218    if ( $DEBUG_sys ) ; then
1219        echo "IGCM_sys_GetDate_FichWork :" $@
1220    fi
1221    # donne la date filesys d'un fichier sur la machine work
1222    IGCM_debug_PopStack "IGCM_sys_FichWork"
1223}
1224
1225#D-#==================================================
1226#D-function IGCM_sys_GetDate_FichArchive
1227#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE
1228#D-* Examples:
1229#D-
1230function IGCM_sys_GetDate_FichArchive {
1231    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
1232    if ( $DEBUG_sys ) ; then
1233        echo "IGCM_sys_GetDate_FichArchive :" $@
1234    fi
1235    IGCM_debug_PopStack "IGCM_sys_FichArchive"
1236}
1237
1238##############################################################
1239# REBUILD OPERATOR
1240
1241function IGCM_sys_rebuild {
1242    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
1243    if ( $DEBUG_sys ) ; then
1244        echo "IGCM_sys_rebuild :" $@
1245    fi
1246    /home/cont003/p86ipsl/CESIUM/bin/rebuild -f -o $@
1247    if [ $? -gt 0 ] ; then
1248       echo "IGCM_sys_rebuild : erreur ${@}."
1249       IGCM_debug_Exit "rebuild"
1250    fi
1251
1252    IGCM_debug_PopStack "IGCM_sys_rebuild"
1253}
1254
1255##############################################################
1256# NCO OPERATOR
1257
1258function IGCM_sys_ncap {
1259    IGCM_debug_PushStack "IGCM_sys_ncap" -- $@
1260    if ( $DEBUG_sys ) ; then
1261        echo "IGCM_sys_ncap :" $@
1262    fi
1263    ncap $@
1264    if [ $? -gt 0 ] ; then
1265       echo "IGCM_sys_ncap : erreur ${@}."
1266#       IGCM_debug_Exit "ncap"
1267    fi
1268
1269    IGCM_debug_PopStack "IGCM_sys_ncap"
1270}
1271
1272ncatted=ncatted
1273# Problem with ksh and string passed in this function to ncatted !
1274# function IGCM_sys_ncatted {
1275#     IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
1276#     if ( $DEBUG_sys ) ; then
1277#       echo "IGCM_sys_ncatted :" $@
1278#     fi
1279#     ncatted $@
1280#     if [ $? -gt 0 ] ; then
1281#        echo "IGCM_sys_ncatted : erreur ${@}."
1282#        IGCM_debug_Exit "ncatted"
1283#     fi
1284
1285#     IGCM_debug_PopStack "IGCM_sys_ncatted"
1286# }
1287
1288function IGCM_sys_ncbo {
1289    IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
1290    if ( $DEBUG_sys ) ; then
1291        echo "IGCM_sys_ncbo :" $@
1292    fi
1293    ncbo $@
1294    if [ $? -gt 0 ] ; then
1295       echo "IGCM_sys_ncbo : erreur ${@}."
1296#       IGCM_debug_Exit "ncbo"
1297    fi
1298
1299    IGCM_debug_PopStack "IGCM_sys_ncbo"
1300}
1301
1302function IGCM_sys_ncdiff {
1303    IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
1304    if ( $DEBUG_sys ) ; then
1305        echo "IGCM_sys_ncdiff :" $@
1306    fi
1307    ncdiff $@
1308    if [ $? -gt 0 ] ; then
1309       echo "IGCM_sys_ncdiff : erreur ${@}."
1310#       IGCM_debug_Exit "ncdiff"
1311    fi
1312
1313    IGCM_debug_PopStack "IGCM_sys_ncdiff"
1314}
1315
1316function IGCM_sys_ncea {
1317    IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
1318    if ( $DEBUG_sys ) ; then
1319        echo "IGCM_sys_ncea :" $@
1320    fi
1321    ncea $@
1322    if [ $? -gt 0 ] ; then
1323       echo "IGCM_sys_ncea : erreur ${@}."
1324#       IGCM_debug_Exit "ncea"
1325    fi
1326
1327    IGCM_debug_PopStack "IGCM_sys_ncea"
1328}
1329
1330function IGCM_sys_ncecat {
1331    IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
1332    if ( $DEBUG_sys ) ; then
1333        echo "IGCM_sys_ncecat :" $@
1334    fi
1335    ncecat $@
1336    if [ $? -gt 0 ] ; then
1337       echo "IGCM_sys_ncecat : erreur ${@}."
1338#       IGCM_debug_Exit "ncecat"
1339    fi
1340
1341    IGCM_debug_PopStack "IGCM_sys_ncecat"
1342}
1343
1344function IGCM_sys_ncflint {
1345    IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
1346    if ( $DEBUG_sys ) ; then
1347        echo "IGCM_sys_ncflint :" $@
1348    fi
1349    ncflint $@
1350    if [ $? -gt 0 ] ; then
1351       echo "IGCM_sys_ncflint : erreur ${@}."
1352#       IGCM_debug_Exit "ncflint"
1353    fi
1354
1355    IGCM_debug_PopStack "IGCM_sys_ncflint"
1356}
1357
1358function IGCM_sys_ncks {
1359    IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
1360    if ( $DEBUG_sys ) ; then
1361        echo "IGCM_sys_ncks :" $@
1362    fi
1363    ncks $@
1364    if [ $? -gt 0 ] ; then
1365       echo "IGCM_sys_ncks : erreur ${@}."
1366#       IGCM_debug_Exit "ncks"
1367    fi
1368
1369    IGCM_debug_PopStack "IGCM_sys_ncks"
1370}
1371
1372function IGCM_sys_ncpdq {
1373    IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
1374    if ( $DEBUG_sys ) ; then
1375        echo "IGCM_sys_ncpdq :" $@
1376    fi
1377    ncpdq $@
1378    if [ $? -gt 0 ] ; then
1379       echo "IGCM_sys_ncpdq : erreur ${@}."
1380#       IGCM_debug_Exit "ncpdq"
1381    fi
1382
1383    IGCM_debug_PopStack "IGCM_sys_ncpdq"
1384}
1385
1386function IGCM_sys_ncra {
1387    IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
1388    if ( $DEBUG_sys ) ; then
1389        echo "IGCM_sys_ncra :" $@
1390    fi
1391    ncra $@
1392    if [ $? -gt 0 ] ; then
1393       echo "IGCM_sys_ncra : erreur ${@}."
1394#       IGCM_debug_Exit "ncra"
1395    fi
1396
1397    IGCM_debug_PopStack "IGCM_sys_ncra"
1398}
1399
1400function IGCM_sys_ncrcat {
1401    IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
1402    if ( $DEBUG_sys ) ; then
1403        echo "IGCM_sys_ncrcat :" $@
1404    fi
1405    ncrcat $@
1406    if [ $? -gt 0 ] ; then
1407       echo "IGCM_sys_ncrcat : erreur ${@}."
1408#       IGCM_debug_Exit "ncrcat"
1409    fi
1410
1411    IGCM_debug_PopStack "IGCM_sys_ncrcat"
1412}
1413
1414function IGCM_sys_ncrename {
1415    IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
1416    if ( $DEBUG_sys ) ; then
1417        echo "IGCM_sys_ncrename :" $@
1418    fi
1419    ncrename $@
1420    if [ $? -gt 0 ] ; then
1421       echo "IGCM_sys_ncrename : erreur ${@}."
1422#       IGCM_debug_Exit "ncrename"
1423    fi
1424
1425    IGCM_debug_PopStack "IGCM_sys_ncrename"
1426}
1427
1428function IGCM_sys_ncwa {
1429    IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
1430    if ( $DEBUG_sys ) ; then
1431        echo "IGCM_sys_ncwa :" $@
1432    fi
1433    ncwa $@
1434    if [ $? -gt 0 ] ; then
1435       echo "IGCM_sys_ncwa : erreur ${@}."
1436#       IGCM_debug_Exit "ncwa"
1437    fi
1438
1439    IGCM_debug_PopStack "IGCM_sys_ncwa"
1440}
1441
1442##############################################################
1443# CDO OPERATOR
1444
1445function IGCM_sys_cdo {
1446    IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
1447
1448    \cdo $@
1449    if [ $? -gt 0 ] ; then
1450       echo "IGCM_sys_cdo : erreur ${@}."
1451#       IGCM_debug_Exit "cdo"
1452    fi
1453
1454    IGCM_debug_PopStack "IGCM_sys_cdo"
1455}
1456
1457############################################################
1458# Activate Running Environnment Variables
1459
1460function IGCM_sys_activ_variables {
1461    IGCM_debug_PushStack "IGCM_sys_activ_variables"
1462    if ( $DEBUG_sys ) ; then
1463        echo "IGCM_sys_activ_variables"
1464    fi
1465    IGCM_debug_PopStack "IGCM_sys_activ_variables"
1466}
1467
1468############################################################
1469# Desactivate Running Environnment Variables
1470
1471function IGCM_sys_desactiv_variables {
1472    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
1473    if ( $DEBUG_sys ) ; then
1474        echo "IGCM_sys_desactiv_variables"
1475    fi
1476    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
1477}
1478
1479############################################################
1480# Build run file
1481
1482function IGCM_sys_build_run_file {
1483    IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
1484    if ( $DEBUG_sys ) ; then
1485        echo "IGCM_sys_build_run_file"
1486    fi
1487    IGCM_debug_PopStack "IGCM_sys_build_run_file"
1488}
Note: See TracBrowser for help on using the repository browser.