source: trunk/libIGCM/libIGCM_sys/libIGCM_sys_ulam.ksh @ 621

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