Ignore:
Timestamp:
04/01/15 14:54:34 (9 years ago)
Author:
sdipsl
Message:

house keeping in libIGCM_sys (fourth pass). Will ease #248 and #251

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_ada.ksh

    r1180 r1181  
    219219 
    220220#D-#================================================== 
    221 #D-function IGCM_sys_RshMaster 
    222 #D-* Purpose: Connection to frontend machine. 
    223 #D-* Examples: 
    224 #D- 
    225 function IGCM_sys_RshMaster { 
    226   IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 
    227   OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <<-EOF 
    228     export libIGCM=${libIGCM} 
    229     export DEBUG_debug=${DEBUG_debug} 
    230     . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh 
    231     . ${libIGCM}/libIGCM_card/libIGCM_card.ksh 
    232     ${@} 
    233 EOF 
    234   if [ $? -gt 0 ] ; then 
    235     echo "IGCM_sys_RshMaster : erreur." 
    236     IGCM_debug_Exit "IGCM_sys_RshMaster" 
    237   fi 
    238   IGCM_debug_PopStack "IGCM_sys_RshMaster" 
    239 } 
    240  
    241 #D-#================================================== 
    242221#D-function IGCM_sys_RshArchive 
    243222#D-* Purpose: Archive rsh command 
     
    287266 
    288267#D-#================================================== 
    289 #D-function IGCM_sys_RshPost 
    290 #D-* Purpose: Post-process rsh command 
    291 #D-* Examples: 
    292 #D- 
    293 function IGCM_sys_RshPost { 
    294   IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 
    295   if ( $DEBUG_sys ) ; then 
    296     echo "IGCM_sys_RshPost :" $@ 
    297   fi 
    298   # keep standard input (stdin) for the loop onto temporary file 
    299   cat >${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
    300  
    301   OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
    302   if [ $? -gt 0 ] ; then 
    303     echo "IGCM_sys_RshPost : erreur." 
    304     IGCM_debug_Exit "IGCM_sys_RshPost" 
    305   fi 
    306   # delete temporary file 
    307   \rm ${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
    308  
    309   IGCM_debug_PopStack "IGCM_sys_RshPost" 
    310 } 
    311  
    312 #D-#================================================== 
    313 #D-function IGCM_sys_SendMail 
    314 #D-* Purpose: Send mail when simulation is over 
    315 #D-* Examples: 
    316 #D- 
    317 function IGCM_sys_SendMail { 
    318   IGCM_debug_PushStack "IGCM_sys_SendMail" $@ 
    319   if ( $DEBUG_sys ) ; then 
    320     echo "IGCM_sys_SendMail :" $@ 
    321   fi 
    322  
    323   if [ X${1} = XAccounting ] ; then 
    324     status=Accounting 
    325     mailText=jobAccounting.mail 
    326   elif ( ${ExitFlag} ) ; then 
    327     status=failed 
    328     mailText=jobEnd.mail 
    329   else 
    330     status=completed 
    331     mailText=jobEnd.mail 
    332   fi 
    333  
    334   # Update selected mail template 
    335   while read -r line; do 
    336     eval echo $line >> mail.txt ; 
    337   done < ${libIGCM}/libIGCM_sys/${mailText} 
    338  
    339   if [ ! -z ${config_UserChoices_MailName} ] ; then 
    340     mail -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < mail.txt 
    341   elif [ -f ~/.forward ] ; then 
    342     mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < mail.txt 
    343   else 
    344     mail -s "${config_UserChoices_JobName} ${status}" ${USER} < mail.txt 
    345   fi 
    346  
    347   sleep 10 
    348   rm -f mail.txt 
    349  
    350   IGCM_debug_PopStack "IGCM_sys_SendMail" 
    351 } 
    352  
    353 #D-#================================================== 
    354 #D-function IGCM_sys_Mkdir 
    355 #D-* Purpose: Master locale mkdir command 
    356 #D-* Examples: 
    357 #D- 
    358 function IGCM_sys_Mkdir { 
    359   IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ 
    360   if ( $DEBUG_sys ) ; then 
    361     echo "IGCM_sys_Mkdir :" $@ 
    362   fi 
    363   if [ ! -d ${1} ]; then 
    364     \mkdir -p $1 
    365     if [ $? -gt 0 ] ; then 
    366       echo "IGCM_sys_Mkdir : erreur." 
    367       IGCM_debug_Exit "IGCM_sys_Mkdir" 
    368     fi 
    369   fi 
    370   # vérification : 
    371   if [ ! -d ${1} ] ; then 
    372     echo "IGCM_sys_Mkdir : erreur." 
    373     IGCM_debug_Exit "IGCM_sys_Mkdir" 
    374   fi 
    375   IGCM_debug_PopStack "IGCM_sys_Mkdir" 
    376 } 
    377  
    378 #D-#================================================== 
    379268#D-function IGCM_sys_MkdirArchive 
    380269#D-* Purpose: Mkdir on Archive 
     
    404293 
    405294#D-#================================================== 
    406 #D-function IGCM_sys_MkdirWork 
    407 #D-* Purpose: Mkdir on Work 
    408 #D-* Examples: 
    409 #D- 
    410 function IGCM_sys_MkdirWork { 
    411   IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ 
    412   if ( $DEBUG_sys ) ; then 
    413     echo "IGCM_sys_MkdirWork :" $@ 
    414   fi 
    415   #- creation de repertoire sur le serveur fichier 
    416   if [ ! -d ${1} ]; then 
    417     \mkdir -p $1 
    418     if [ $? -gt 0 ] ; then 
    419       echo "IGCM_sys_MkdirWork : erreur." 
    420       IGCM_debug_Exit "IGCM_sys_MkdirWork" 
    421     fi 
    422   fi 
    423   IGCM_debug_PopStack "IGCM_sys_MkdirWork" 
    424 } 
    425  
    426 #D-#================================================== 
    427 #D-function IGCM_sys_Cd 
    428 #D-* Purpose: master cd command 
    429 #D-* Examples: 
    430 #D- 
    431 function IGCM_sys_Cd { 
    432   IGCM_debug_PushStack "IGCM_sys_Cd" $@ 
    433   if ( $DEBUG_sys ) ; then 
    434     echo "IGCM_sys_Cd :" $@ 
    435   fi 
    436   \cd $1 
    437   if [ $? -gt 0 ] ; then 
    438     echo "IGCM_sys_Cd : erreur." 
    439     IGCM_debug_Exit "IGCM_sys_Cd" 
    440   fi 
    441   IGCM_debug_PopStack "IGCM_sys_Cd" 
    442 } 
    443  
    444 #D-#================================================== 
    445 #D-function IGCM_sys_Chmod 
    446 #D-* Purpose: Chmod 
    447 #D-* Examples: 
    448 #D- 
    449 function IGCM_sys_Chmod { 
    450   IGCM_debug_PushStack "IGCM_sys_Chmod" $@ 
    451   if ( $DEBUG_sys ) ; then 
    452     echo "IGCM_sys_Chmod :" $@ 
    453   fi 
    454   \chmod $@ 
    455   if [ $? -gt 0 ] ; then 
    456     echo "IGCM_sys_Chmod : erreur." 
    457     IGCM_debug_Exit "IGCM_sys_Chmod" 
    458   fi 
    459   IGCM_debug_PopStack "IGCM_sys_Chmod" 
    460 } 
    461  
    462 #D-#================================================== 
    463 #D-function IGCM_sys_FileSize 
    464 #D-* Purpose: Filesize 
    465 #D-* Examples: 
    466 #D- 
    467 function IGCM_sys_FileSize { 
    468   IGCM_debug_PushStack "IGCM_sys_FileSize" $@ 
    469  
    470   typeset sizeF 
    471   set +A sizeF -- $( ls -la ${1} ) 
    472   if [ $? -gt 0 ] ; then 
    473     IGCM_debug_Exit "IGCM_sys_FileSize" 
    474   fi 
    475   eval ${2}=${sizeF[4]} 
    476  
    477   IGCM_debug_PopStack "IGCM_sys_FileSize" 
    478 } 
    479  
    480 #D-#================================================== 
    481 #D-function IGCM_sys_TestDir 
    482 #D-* Purpose: Test Directory that must exists 
    483 #D-* Examples: 
    484 #D- 
    485 function IGCM_sys_TestDir { 
    486   IGCM_debug_PushStack "IGCM_sys_TestDir" $@ 
    487   if ( $DEBUG_sys ) ; then 
    488     echo "IGCM_sys_TestDir :" $@ 
    489   fi 
    490   typeset ExistFlag 
    491   ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 
    492   IGCM_debug_PopStack "IGCM_sys_TestDir" 
    493  
    494   return ${ExistFlag} 
    495 } 
    496  
    497 #D-#================================================== 
    498295#D-function IGCM_sys_TestDirArchive 
    499296#D-* Purpose: Test Directory that must exists on Archive 
     
    544341  ExistFlag=$( IGCM_sys_RshArchive "[ -f $1 ] && echo 0 || echo 1" ) 
    545342  IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 
    546  
    547   return ${ExistFlag} 
    548 } 
    549  
    550 #D-#================================================== 
    551 #D-function IGCM_sys_TestFileBuffer 
    552 #D-* Purpose: Test file that must NOT EXISTS on Buffer 
    553 #D-* Examples: 
    554 #D- 
    555 function IGCM_sys_TestFileBuffer { 
    556   IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ 
    557   typeset ExistFlag 
    558   ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 
    559   IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" 
    560343 
    561344  return ${ExistFlag} 
     
    585368 
    586369#D-#================================================== 
    587 #D-function IGCM_sys_CountFileBuffer 
    588 #D-* Purpose: Count files on Scratch filesystem 
    589 #D-* Examples: 
    590 #D- 
    591 function IGCM_sys_CountFileBuffer { 
    592   IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ 
    593   ls ${@} 2>/dev/null | wc -l 
    594   if [ $? -gt 0 ] ; then 
    595     echo "IGCM_sys_CountFileBuffer : erreur." 
    596   fi 
    597   IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" 
    598 } 
    599  
    600 #D-#================================================== 
    601370#D-function IGCM_sys_Tree 
    602371#D-* Purpose: Tree directories with files on ${ARCHIVE} 
     
    612381 
    613382  IGCM_debug_PopStack "IGCM_sys_Tree" 
    614 } 
    615  
    616 #D-#================================================== 
    617 #D-function IGCM_sys_Tar 
    618 #D-* Purpose: master tar command 
    619 #D-* Examples: 
    620 #D- 
    621 function IGCM_sys_Tar { 
    622   IGCM_debug_PushStack "IGCM_sys_Tar" $@ 
    623   if ( $DEBUG_sys ) ; then 
    624     echo "IGCM_sys_Tar :" $@ 
    625   fi 
    626   \tar cf $@ 
    627   if [ $? -gt 0 ] ; then 
    628     echo "IGCM_sys_Tar : erreur." 
    629     IGCM_debug_Exit "IGCM_sys_Tar" 
    630   fi 
    631   IGCM_debug_PopStack "IGCM_sys_Tar" 
    632 } 
    633  
    634 #D-#================================================== 
    635 #D-function IGCM_sys_UnTar 
    636 #D-* Purpose: master un-tar command 
    637 #D-* Examples: 
    638 #D- 
    639 function IGCM_sys_UnTar { 
    640   IGCM_debug_PushStack "IGCM_sys_UnTar" $@ 
    641   if ( $DEBUG_sys ) ; then 
    642     echo "IGCM_sys_UnTar :" $@ 
    643   fi 
    644   \tar xvf $1 
    645   if [ $? -gt 0 ] ; then 
    646     echo "IGCM_sys_UnTar : erreur." 
    647     IGCM_debug_Exit "IGCM_sys_UnTar" 
    648   fi 
    649   IGCM_debug_PopStack "IGCM_sys_UnTar" 
    650383} 
    651384 
     
    720453 
    721454#D-#================================================== 
    722 #D-function IGCM_sys_Rsync_out 
    723 #D-* Purpose: treat return val of rsync 
    724 #D-* Examples: IGCM_sys_Rsync_out out_RET_rsync 
    725 #D-  Error values and explanations can depend on your system version. 
    726 function IGCM_sys_Rsync_out { 
    727   status=$1 
    728   if [ ! $status ] ; then 
    729     echo "rsync error !" 
    730   fi 
    731  
    732   if [ $MYLANG = "fr" ]; then 
    733     case $status in 
    734     0)  return ;; 
    735     1)  echo "Erreur de rsync ; RERR_SYNTAX : " 
    736       echo "Erreur de syntaxe ou d'utilisation." 
    737       return;; 
    738     2)  echo "Erreur de rsync ; RERR_PROTOCOL : " 
    739       echo "Incompatibilité de protocole." 
    740       return;; 
    741     3)  echo "Erreur de rsync ; RERR_FILESELECT 3" 
    742       echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et" 
    743       echo "répertoires" 
    744       return;; 
    745     4)  echo "Erreur de rsync ; RERR_UNSUPPORTED" 
    746       echo "Action demandée non supportée : une tentative de manipulation de" 
    747       echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a" 
    748       echo "été faite ; ou une option qui est supportée par le  client  mais" 
    749       echo "pas par le serveur a été spécifiée." 
    750       return;; 
    751     10) echo "Erreur de rsync ; RERR_SOCKETIO" 
    752       echo "Erreur dans le socket d'entrée sortie" 
    753       return;; 
    754     11) echo "Erreur de rsync ; RERR_FILEIO" 
    755       echo "Erreur d'entrée sortie fichier" 
    756       return;; 
    757     12) echo "Erreur de rsync ; RERR_STREAMIO" 
    758       echo "Erreur dans flux de donnée du protocole rsync" 
    759       return;; 
    760     13) echo "Erreur de rsync ; RERR_MESSAGEIO" 
    761       echo "Erreur avec les diagnostics du programme" 
    762       return;; 
    763     14) echo "Erreur de rsync ; RERR_IPC" 
    764       echo "Erreur dans le code IPC" 
    765       return;; 
    766     20) echo "Erreur de rsync ; RERR_SIGNAL" 
    767       echo "SIGUSR1 ou SIGINT reçu" 
    768       return;; 
    769     21) echo "Erreur de rsync ; RERR_WAITCHILD" 
    770       echo "Une erreur retournée par waitpid()" 
    771       return;; 
    772     22) echo "Erreur de rsync ; RERR_MALLOC" 
    773       echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 
    774       return;; 
    775     23) echo "" 
    776       echo "Erreur fichier inexistant" 
    777       return;; 
    778     30) echo "Erreur de rsync ; RERR_TIMEOUT" 
    779       echo "Temps d'attente écoulé dans l'envoi/réception de données" 
    780       return;; 
    781     *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $status 
    782       return;; 
    783     esac 
    784   elif [ $MYLANG = "en" ] ; then 
    785     case $status in 
    786     0)  return;; 
    787     1)  echo "rsync error : Syntax or usage error " 
    788       return;; 
    789     2)  echo "rsync error : Protocol incompatibility " 
    790       return;; 
    791     3)  echo "rsync error : Errors selecting input/output files, dirs" 
    792       return;; 
    793     4)  echo "rsync error : Requested action not supported: an attempt" 
    794       echo "was made to manipulate 64-bit files on a platform that cannot support" 
    795       echo "them; or an option was specified that is supported by the client and" 
    796       echo "not by the server." 
    797       return;; 
    798     5)  echo "rsync error : Error starting client-server protocol" 
    799       return;; 
    800     10) echo "rsync error : Error in socket I/O " 
    801       return;; 
    802     11) echo "rsync error : Error in file I/O " 
    803       return;; 
    804     12) echo "rsync error : Error in rsync protocol data stream " 
    805       return;; 
    806     13) echo "rsync error : Errors with program diagnostics " 
    807       return;; 
    808     14) echo "rsync error : Error in IPC code " 
    809       return;; 
    810     20) echo "rsync error : Received SIGUSR1 or SIGINT " 
    811       return;; 
    812     21) echo "rsync error : Some error returned by waitpid() " 
    813       return;; 
    814     22) echo "rsync error : Error allocating core memory buffers " 
    815       return;; 
    816     23) echo "rsync error : Partial transfer due to error" 
    817       return;; 
    818     24) echo "rsync error : Partial transfer due to vanished source files" 
    819       return;; 
    820     30) echo "rsync error : Timeout in data send/receive " 
    821       return;; 
    822     *)  echo "rsync error : return code of rsync unknown :" $status 
    823       return;; 
    824     esac 
    825   else 
    826     echo "unknown language $MYLANG." 
    827     return 
    828   fi 
    829 } 
    830  
    831 #D-#================================================== 
    832 #D-function IGCM_sys_Miror_libIGCM 
    833 #D-* Purpose: Mirror libIGCM PATH and lib to frontend 
    834 #D-* Examples: 
    835 #D- 
    836 function IGCM_sys_Mirror_libIGCM { 
    837   IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" 
    838   if ( $DEBUG_sys ) ; then 
    839     echo "IGCM_sys_Mirror_libIGCM" 
    840   fi 
    841  
    842   typeset status 
    843  
    844   mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} 
    845  
    846   echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    847   ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    848   status=$? 
    849  
    850   if [ ${status} -gt 0 ] ; then 
    851     echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend." 
    852     cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    853   fi 
    854   IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" 
    855 } 
    856  
    857 #D-#================================================== 
    858 #D-function IGCM_sys_Cp 
    859 #D-* Purpose: generic cp 
    860 #D-* Examples: 
    861 #D- 
    862 function IGCM_sys_Cp { 
    863   IGCM_debug_PushStack "IGCM_sys_Cp" $@ 
    864   if ( $DEBUG_sys ) ; then 
    865     echo "IGCM_sys_Cp :" $@ 
    866   fi 
    867  
    868   typeset status 
    869  
    870   echo cp $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    871   \cp $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    872   status=$? 
    873  
    874   if [ ${status} -gt 0 ] ; then 
    875     echo "IGCM_sys_Cp : error code ${status}" 
    876     cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    877     IGCM_debug_Exit "IGCM_sys_Cp" 
    878   else 
    879     \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    880   fi 
    881   IGCM_debug_PopStack "IGCM_sys_Cp" 
    882 } 
    883  
    884 #D-#================================================== 
    885 #D-function IGCM_sys_Rm 
    886 #D-* Purpose: generic rm 
    887 #D-* Examples: 
    888 #D- 
    889 function IGCM_sys_Rm { 
    890   IGCM_debug_PushStack "IGCM_sys_Rm" $@ 
    891   if ( $DEBUG_sys ) ; then 
    892     echo "IGCM_sys_Rm :" $@ 
    893   fi 
    894  
    895   typeset status 
    896  
    897   echo rm $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    898   \rm $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    899   status=$? 
    900  
    901   if [ ${status} -gt 0 ] ; then 
    902     echo "IGCM_sys_Rm : error code ${status}" 
    903     cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    904     IGCM_debug_Exit "IGCM_sys_Rm" 
    905   else 
    906     \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    907   fi 
    908   IGCM_debug_PopStack "IGCM_sys_Rm" 
    909 } 
    910  
    911 #D-#================================================== 
    912455#D-function IGCM_sys_RmRunDir 
    913456#D-* Purpose: rm tmpdir (dummy function most of the time batch 
     
    922465  fi 
    923466  IGCM_debug_PopStack "IGCM_sys_RmRunDir" 
    924 } 
    925  
    926 #D-#================================================== 
    927 #D-function IGCM_sys_Mv 
    928 #D-* Purpose: generic move 
    929 #D-* Examples: 
    930 #D- 
    931 function IGCM_sys_Mv { 
    932   IGCM_debug_PushStack "IGCM_sys_Mv" $@ 
    933   if ( $DEBUG_sys ) ; then 
    934     echo "IGCM_sys_Mv :" $@ 
    935   fi 
    936  
    937   if [ $DRYRUN = 0 ]; then 
    938  
    939     typeset status 
    940  
    941     echo mv $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    942     \mv $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    943     status=$? 
    944  
    945     if [ ${status} -gt 0 ] ; then 
    946       echo "IGCM_sys_Mv : error code ${status}" 
    947       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    948       IGCM_debug_Exit "IGCM_sys_Mv" 
    949     else 
    950       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    951     fi 
    952   fi 
    953   IGCM_debug_PopStack "IGCM_sys_Mv" 
    954467} 
    955468 
     
    1058571 
    1059572#D-#================================================== 
    1060 #D-function IGCM_sys_Get_Master 
    1061 #D-* Purpose: Copy a complete directory from MASTER filesystem 
    1062 #D-* Examples: 
    1063 #D- 
    1064 function IGCM_sys_Get_Master { 
    1065   IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ 
    1066   if ( $DEBUG_sys ) ; then 
    1067     echo "IGCM_sys_Get_Master :" $@ 
    1068   fi 
    1069   if [ $DRYRUN = 0 ]; then 
    1070     if ( [ ! -d ${1} ] && [ ! -f ${1} ] ) ; then 
    1071       echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." 
    1072       IGCM_debug_PopStack "IGCM_sys_Get_Master" 
    1073       return 
    1074     fi 
    1075  
    1076     typeset NB_ESSAI DELAI status i 
    1077     # number of tentative 
    1078     NB_ESSAI=3 
    1079     # time delay between tentative 
    1080     DELAI=2 
    1081  
    1082     i=0 
    1083     while [ $i -lt $NB_ESSAI ] ; do 
    1084       \cp -urL $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    1085       status=$? 
    1086       if [ ${status} -gt 0 ]; then 
    1087         IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}" 
    1088         IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." 
    1089         sleep $DELAI 
    1090       else 
    1091         break 
    1092       fi 
    1093       (( i = i + 1 )) 
    1094     done 
    1095  
    1096     if [ ${status} -gt 0 ] ; then 
    1097       echo "IGCM_sys_Get_Master : error." 
    1098       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1099       IGCM_debug_Exit "IGCM_sys_Get_Master" 
    1100     else 
    1101       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1102     fi 
    1103   fi 
    1104   IGCM_debug_PopStack "IGCM_sys_Get_Master" 
    1105 } 
    1106  
    1107 #==================================================== 
    1108 #- Call IGCM_sys_Mirror_libIGCM now ! 
    1109 if ( $MirrorlibIGCM ) ; then 
    1110   IGCM_sys_Mirror_libIGCM 
    1111 fi 
    1112  
    1113 #D-#================================================== 
    1114573#D-function IGCM_sys_Put_Rest 
    1115574#D-* Purpose: Put computied restarts on ${ARCHIVE}. 
     
    1173632 
    1174633#D-#================================================== 
    1175 #D-function IGCM_sys_PutBuffer_Rest 
    1176 #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 
    1177 #D-           File and target directory must exist. 
    1178 #D-* Examples: 
    1179 #D- 
    1180 function IGCM_sys_PutBuffer_Rest { 
    1181   IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 
    1182   if ( $DEBUG_sys ) ; then 
    1183     echo "IGCM_sys_PutBuffer_Rest :" $@ 
    1184   fi 
    1185   if [ $DRYRUN = 0 ]; then 
    1186     if [ ! -f ${1} ] ; then 
    1187       echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 
    1188       IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
    1189     fi 
    1190  
    1191     typeset status 
    1192     # 
    1193     # USUAL WAY 
    1194     \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    1195     status=$? 
    1196  
    1197     if [ ${status} -gt 0 ] ; then 
    1198       echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 
    1199       [ -f ${2} ] && ls -l ${2} 
    1200       [ -f ${2}/${1} ] && ls -l ${2}/${1} 
    1201       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1202       IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
    1203     else 
    1204  
    1205       if [ X${JobType} = XRUN ] ; then 
    1206         [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} 
    1207         [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} 
    1208       fi 
    1209  
    1210       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1211     fi 
    1212   fi 
    1213   IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" 
    1214 } 
    1215  
    1216 #D-#================================================== 
    1217 #D-function IGCM_sys_PrepareTaredRestart 
    1218 #D-* Purpose: Prepare tared restart to be access by computing job. 
    1219 #D-* Examples: 
    1220 #D- 
    1221 function IGCM_sys_PrepareTaredRestart { 
    1222   IGCM_debug_PushStack "IGCM_sys_PrepareTaredRestart" $@ 
    1223   if [ $DRYRUN = 0 ]; then 
    1224     [ ! -f $( basename $1 ) ] && IGCM_sys_Get $1 . 
    1225   fi 
    1226   IGCM_debug_PopStack "IGCM_sys_PrepareTaredRestart" 
    1227 } 
    1228  
    1229 #D-#================================================== 
    1230634#D-function IGCM_sys_Put_Out 
    1231635#D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly 
     
    1293697 
    1294698#D-#================================================== 
    1295 #D-function IGCM_sys_PutBuffer_Out 
    1296 #D-* Purpose: Copy a file on ${WORKDIR} after having chmod it in readonly 
    1297 #D-* Examples: 
    1298 #D- 
    1299 function IGCM_sys_PutBuffer_Out { 
    1300   IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ 
    1301   if ( $DEBUG_sys ) ; then 
    1302     echo "IGCM_sys_PutBuffer_Out :" $@ 
    1303   fi 
    1304  
    1305   typeset NB_ESSAI DELAI status i exist skip 
    1306  
    1307   # number of tentative 
    1308   NB_ESSAI=3 
    1309   # time delay between tentative 
    1310   DELAI=2 
    1311  
    1312   if [ $DRYRUN = 0 ]; then 
    1313     if [ ! -f ${1} ] ; then 
    1314       echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." 
    1315       IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 
    1316       return 1 
    1317     fi 
    1318     # 
    1319     IGCM_sys_Mkdir $( dirname $2 ) 
    1320     # 
    1321  
    1322     exist=false 
    1323     skip=false 
    1324     if [ -f $2 ] ; then 
    1325       IGCM_debug_Print 1 "$2 already exist" 
    1326       exist=true 
    1327       if [ "X$( diff $1 $2 )" = X ] ; then 
    1328         IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 
    1329         status=0 
    1330         skip=true 
    1331       else 
    1332         IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 
    1333         skip=false 
    1334       fi 
    1335     fi 
    1336     # 
    1337     if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 
    1338       IGCM_sys_Chmod u+w $2 
    1339     fi 
    1340  
    1341     if [ X${skip} = Xfalse ] ; then 
    1342       i=0 
    1343       while [ $i -lt $NB_ESSAI ] ; do 
    1344         if [ $( stat -c %d $1 ) -ne $( stat -c %d $( dirname $2 ) ) ] ; then 
    1345           # USUAL WAY 
    1346           \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    1347           status=$? 
    1348         else 
    1349           # NOT SO USUAL WAY 
    1350           \mv $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    1351           status=$? 
    1352         fi 
    1353         if [ ${status} -gt 0 ]; then 
    1354           IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 
    1355           IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again." 
    1356           [ -f ${2} ] && ls -l ${2} 
    1357           [ -f ${2}/${1} ] && ls -l ${2}/${1} 
    1358           sleep $DELAI 
    1359         else 
    1360           break 
    1361         fi 
    1362         (( i = i + 1 )) 
    1363       done 
    1364     fi 
    1365  
    1366     if [ ${status} -gt 0 ] ; then 
    1367       echo "IGCM_sys_PutBuffer_Out : error." 
    1368       [ -f ${2} ] && ls -l ${2} 
    1369       [ -f ${2}/${1} ] && ls -l ${2}/${1} 
    1370       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1371       IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 
    1372     else 
    1373  
    1374       if [ X${JobType} = XRUN ] ; then 
    1375         if [ X${3} = X ] ; then 
    1376           [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} 
    1377           [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} 
    1378         fi 
    1379       fi 
    1380  
    1381       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1382     fi 
    1383   fi 
    1384   IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 
    1385   return 0 
    1386 } 
    1387  
    1388 #D-#================================================== 
    1389699#D-function IGCM_sys_Get 
    1390700#D-* Purpose: Get a file from ${ARCHIVE} 
     
    1456766  fi 
    1457767  IGCM_debug_PopStack "IGCM_sys_Get" 
    1458 } 
    1459  
    1460 #D-#================================================== 
    1461 #D-function IGCM_sys_GetBuffer 
    1462 #D-* Purpose: Get a file from ${SCRATCHDIR} 
    1463 #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX 
    1464 #D-            IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ 
    1465 function IGCM_sys_GetBuffer { 
    1466   IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
    1467  
    1468   typeset DEST buf_liste target file_work 
    1469   typeset NB_ESSAI DELAI status i 
    1470  
    1471   if ( $DEBUG_sys ) ; then 
    1472     echo "IGCM_sys_GetBuffer :" $@ 
    1473   fi 
    1474  
    1475   # number of tentative 
    1476   NB_ESSAI=3 
    1477   # time delay between tentative 
    1478   DELAI=2 
    1479  
    1480   if [ $DRYRUN -le 2 ]; then 
    1481     if [ X${1} = X'/l' ] ; then 
    1482       eval set +A buf_liste \${${2}} 
    1483     else 
    1484       eval set +A buf_liste ${1} 
    1485     fi 
    1486     eval DEST=\${${#}} 
    1487  
    1488     #USUAL WAY 
    1489     if [ X${1} = X'/l' ] ; then 
    1490       for target in ${buf_liste[*]} ; do 
    1491         local_file=$( basename ${target} ) 
    1492         i=0 
    1493         while [ $i -lt $NB_ESSAI ] ; do 
    1494           \cp ${target} ${DEST}/${local_file} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    1495           status=$? 
    1496           if [ ${status} -gt 0 ]; then 
    1497             IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" 
    1498             IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." 
    1499             sleep $DELAI 
    1500           else 
    1501             break 
    1502           fi 
    1503           (( i = i + 1 )) 
    1504         done 
    1505         if [ ${status} -gt 0 ] ; then 
    1506           echo "IGCM_sys_Get : error" 
    1507           cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1508           \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1509           IGCM_debug_Exit "IGCM_sys_GetBuffer" 
    1510         else 
    1511           \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1512         fi 
    1513       done 
    1514     else 
    1515       i=0 
    1516       while [ $i -lt $NB_ESSAI ] ; do 
    1517         \cp ${buf_liste} ${DEST} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    1518         status=$? 
    1519         if [ ${status} -gt 0 ]; then 
    1520           IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" 
    1521           IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." 
    1522           sleep $DELAI 
    1523         else 
    1524           break 
    1525         fi 
    1526         (( i = i + 1 )) 
    1527       done 
    1528       if [ ${status} -gt 0 ] ; then 
    1529         echo "IGCM_sys_Get : error" 
    1530         cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1531         \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1532         IGCM_debug_Exit "IGCM_sys_GetBuffer" 
    1533       else 
    1534         \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1535       fi 
    1536     fi 
    1537   fi 
    1538   IGCM_debug_PopStack "IGCM_sys_GetBuffer" 
    1539 } 
    1540  
    1541 #D-#================================================== 
    1542 #D-function IGCM_sys_GetDate_FichWork 
    1543 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK 
    1544 #D-* Examples: 
    1545 #D- 
    1546 function IGCM_sys_GetDate_FichWork { 
    1547   IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 
    1548   if ( $DEBUG_sys ) ; then 
    1549     echo "IGCM_sys_GetDate_FichWork :" $@ 
    1550   fi 
    1551  
    1552   if [ $# -ge 3 ] ; then 
    1553     mode=$3 
    1554     TimeStyle=$4 
    1555   else 
    1556     mode="default" 
    1557     TimeStyle="%Y%m%d%H%M%S" 
    1558   fi 
    1559  
    1560   typeset dateF 
    1561   set +A dateF -- $( ls -l --full-time --time-style=+"${TimeStyle}" ${1} ) 
    1562  
    1563   case $mode in 
    1564     "default") 
    1565       eval ${2}=${dateF[5]} 
    1566       ;; 
    1567     "SplitFields") 
    1568       eval ${2}="${dateF[5]}\ ${dateF[6]}" 
    1569       ;; 
    1570   esac 
    1571  
    1572  
    1573   # donne la date filesys d'un fichier sur la machine work 
    1574   IGCM_debug_PopStack "IGCM_sys_FichWork" 
    1575 } 
    1576  
    1577 #D-#================================================== 
    1578 #D-function IGCM_sys_GetDate_FichArchive 
    1579 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
    1580 #D-* Examples: 
    1581 #D- 
    1582 function IGCM_sys_GetDate_FichArchive { 
    1583   IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 
    1584   if ( $DEBUG_sys ) ; then 
    1585     echo "IGCM_sys_GetDate_FichArchive :" $@ 
    1586   fi 
    1587   typeset dateF 
    1588   set +A dateF -- $( rsh ${STOREHOST} -n ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 
    1589   eval ${2}=${dateF[5]} 
    1590  
    1591   IGCM_debug_PopStack "IGCM_sys_FichArchive" 
    1592768} 
    1593769 
     
    1668844  fi 
    1669845  IGCM_debug_PopStack "IGCM_sys_sync" 
    1670 } 
    1671  
    1672 #D-#================================================== 
    1673 #D-function IGCM_sys_rebuild 
    1674 #D-* Purpose: rebuild parallel files 
    1675 #D-* Examples: 
    1676 #D- 
    1677 function IGCM_sys_rebuild { 
    1678   IGCM_debug_PushStack "IGCM_sys_rebuild" $@ 
    1679   if ( $DEBUG_sys ) ; then 
    1680     echo "IGCM_sys_rebuild :" $@ 
    1681   fi 
    1682  
    1683   typeset NB_ESSAI DELAI status i firstArg 
    1684   # number of tentative 
    1685   NB_ESSAI=3 
    1686   # time delay between tentative 
    1687   DELAI=2 
    1688  
    1689   i=0 
    1690   while [ $i -lt $NB_ESSAI ] ; do 
    1691     rebuild -f -o $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    1692     status=$? 
    1693     if [ ${status} -gt 0 ] ; then 
    1694       IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 
    1695       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1696       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1697       IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    1698       firstArg=${1} 
    1699       \rm ${firstArg} 
    1700       sleep $DELAI 
    1701     else 
    1702       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    1703       break 
    1704     fi 
    1705     (( i = i + 1 )) 
    1706   done 
    1707  
    1708   if [ ${status} -gt 0 ] ; then 
    1709     echo "IGCM_sys_rebuild : rebuild error code is ${status}" 
    1710     IGCM_debug_Exit "rebuild" 
    1711   fi 
    1712  
    1713   IGCM_debug_PopStack "IGCM_sys_rebuild" 
    1714 } 
    1715  
    1716 #D-#================================================== 
    1717 #D-function IGCM_sys_rebuild_station 
    1718 #D-* Purpose: rebuild parallel files describing station 
    1719 #D-* Examples: 
    1720 #D- 
    1721 function IGCM_sys_rebuild_station { 
    1722   IGCM_debug_PushStack "IGCM_sys_rebuild_station" $@ 
    1723   typeset i list_opt file_in file_out prefix_invert list_invert 
    1724   if ( $DEBUG_sys ) ; then 
    1725     echo "IGCM_sys_rebuild_station :" $@ 
    1726   fi 
    1727   list_opt=$@ 
    1728  
    1729   # Invert Axis : t,x -> x,t 
    1730   #               t,pres,x -> x,t,pres 
    1731   # So that we can concatenate along x 
    1732   i=0 
    1733   for file_in in ${list_opt} ; do 
    1734     (( i = i + 1)) 
    1735     [ ${i} = 1 ] && file_out=${file_in} && continue 
    1736     # detect time counter and do the job only if present 
    1737     var_unlim=$(ncdump -h ${file_in} | grep UNLIMITED | cut -d ' ' -f 1 | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') 
    1738     if [ X${var_unlim} = Xtime_counter ] ; then 
    1739       prefix_invert=$( basename ${file_in} .nc ) 
    1740       IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc 
    1741       list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc 
    1742     fi 
    1743   done 
    1744  
    1745   # Concatenate 
    1746   IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc 
    1747  
    1748   # Re-ivert file 
    1749   IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out} 
    1750  
    1751   # Station re-ordering is too expansive to be run within libIGCM 
    1752   # This is due to (ncpdq - nrcat - ncpdq) I/O sequence. 
    1753   # This re-ordering must be done "in memory" by the cmorization process 
    1754   # Anyway this is the best sequence using (ncpdq - nrcat - ncpdq) 
    1755   # BEGIN reordering 
    1756  
    1757   # Only LMDZ text output contains the exact ordering of the station. 
    1758   # We isolate this in the code below: 
    1759   #  0  38  -157.5000000000000  70.98591549295774 
    1760   #  0  54  27.49999999999999   67.18309859154928 
    1761   #  0  56  -62.50000000000001  82.39436619718309 
    1762   #  0  79  12.49999999999999   78.59154929577466 
    1763   #  0  116 -165.0000000000000  76.05633802816901 
    1764   #  0  117 130.0000000000000   70.98591549295774 
    1765   #  0  118 110.0000000000000   87.46478873239437 
    1766   #  1  40  4.999999999999995   51.97183098591550 
    1767  
    1768 #  typeset iStation iProc list_opt file_in file_out prefix_invert 
    1769 #  typeset -Z4 j4 
    1770 #  typeset -Z3 j3 
    1771  
    1772 #  unset list_opt 
    1773 #  set +A list_opt $@ 
    1774  
    1775   # Filename after rebuild 
    1776 #  file_out=${list_opt[0]} 
    1777   # Prefix of output files 
    1778 #  prefix_invert=$( basename ${file_out} .nc ) 
    1779   # Number of procs 
    1780 #  num_proc=$( grep -i mpi_size ${PREFIX}_${Exe_Output} | wc -l ) 
    1781  
    1782 #  iProc=0 
    1783 #  while [ ${iProc} -lt ${num_proc} ] ; do 
    1784     # Array containing Station as a number 
    1785 #    unset proc_stn 
    1786 #    set +A proc_stn $( grep "iophy_mpi rank ip lon lat  $iProc" ${PREFIX}_${Exe_Output} | sed -e "s/iophy_mpi rank ip lon lat //g" | gawk ' {print $2}' ) 
    1787     # Number of stations produced by processor proc 
    1788 #    stationLast=${#proc_stn[*]} 
    1789     # Proc number on 4 digits 
    1790 #    j4=${iProc} 
    1791     # Init 
    1792 #    iStation=0 
    1793 #    while [ ${iStation} -lt ${stationLast} ] ; do 
    1794       # Station number on 3 digits 
    1795 #      j3=${proc_stn[${iStation}]} 
    1796       # Extract station 
    1797       # Invert Axis : t,x -> x,t 
    1798       #               t,pres,x -> x,t,pres 
    1799       # So that we can concatenate along x 
    1800 #      IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs -d x,$iStation,$iStation ${prefix_invert}_${j4}.nc ${prefix_invert}_stn_${j3}.nc 
    1801 #      (( iStation = iStation + 1 )) 
    1802 #    done 
    1803 #    (( iProc = iProc + 1 )) 
    1804 #  done 
    1805  
    1806   # Concatenate all station along x 
    1807 #  IGCM_sys_ncrcat ${prefix_invert}_stn_???.nc ${prefix_invert}_xt.nc 
    1808  
    1809   # Re-invert file 
    1810 #  IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x ${prefix_invert}_xt.nc ${file_out} 
    1811  
    1812   # END reordering 
    1813  
    1814   IGCM_debug_PopStack "IGCM_sys_rebuild_station" 
    1815846} 
    1816847 
     
    21451176  IGCM_debug_PopStack "IGCM_sys_ListJobInQueue" 
    21461177} 
    2147  
    2148 ############################################################## 
    2149 # NCO OPERATOR 
    2150  
    2151 #D-#================================================== 
    2152 #D-function IGCM_sys_ncap2 
    2153 #D-* Purpose: encapsulate ncap2 call so as to manage error code and retry 
    2154 #D-* Examples: 
    2155 #D- 
    2156 function IGCM_sys_ncap2 { 
    2157   IGCM_debug_PushStack "IGCM_sys_ncap2" $@ 
    2158   if ( $DEBUG_sys ) ; then 
    2159     echo "IGCM_sys_ncap2 :" $@ 
    2160   fi 
    2161  
    2162   typeset NB_ESSAI DELAI status i 
    2163   # number of tentative 
    2164   NB_ESSAI=3 
    2165   # time delay between tentative 
    2166   DELAI=2 
    2167  
    2168   i=0 
    2169   while [ $i -lt $NB_ESSAI ] ; do 
    2170     ncap2 -C "$@" > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2171     status=$? 
    2172     if [ ${status} -gt 0 ] ; then 
    2173       IGCM_debug_Print 2 "IGCM_sys_ncap2 : error code ${status}" 
    2174       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2175       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2176       IGCM_debug_Print 2 "IGCM_sys_ncap2 : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2177       sleep $DELAI 
    2178     else 
    2179       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2180       break 
    2181     fi 
    2182     (( i = i + 1 )) 
    2183   done 
    2184  
    2185   if [ ${status} -gt 0 ] ; then 
    2186     echo "IGCM_sys_ncap2 : ncap2 error" 
    2187     IGCM_debug_Exit "ncap2" 
    2188   fi 
    2189  
    2190   IGCM_debug_PopStack "IGCM_sys_ncap2" 
    2191 } 
    2192  
    2193 #D-#================================================== 
    2194 #D-function IGCM_sys_ncatted 
    2195 #D-* Purpose: encapsulate ncatted call so as to manage error code and retry 
    2196 #D-* Examples: 
    2197 #D- 
    2198 function IGCM_sys_ncatted { 
    2199   IGCM_debug_PushStack "IGCM_sys_ncatted" $@ 
    2200   if ( $DEBUG_sys ) ; then 
    2201     echo "IGCM_sys_ncatted :" $@ 
    2202   fi 
    2203  
    2204   typeset NB_ESSAI DELAI status i 
    2205   # number of tentative 
    2206   NB_ESSAI=3 
    2207   # time delay between tentative 
    2208   DELAI=2 
    2209  
    2210   i=0 
    2211   while [ $i -lt $NB_ESSAI ] ; do 
    2212     ncatted "$@" > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2213     status=$? 
    2214     if [ ${status} -gt 0 ] ; then 
    2215       IGCM_debug_Print 2 "IGCM_sys_ncatted : error code ${status}" 
    2216       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2217       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2218       IGCM_debug_Print 2 "IGCM_sys_ncatted : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2219       sleep $DELAI 
    2220     else 
    2221       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2222       break 
    2223     fi 
    2224     (( i = i + 1 )) 
    2225   done 
    2226  
    2227   if [ ${status} -gt 0 ] ; then 
    2228     echo "IGCM_sys_ncatted : ncatted error" 
    2229     IGCM_debug_Exit "ncatted" 
    2230   fi 
    2231  
    2232   IGCM_debug_PopStack "IGCM_sys_ncatted" 
    2233 } 
    2234  
    2235 #D-#================================================== 
    2236 #D-function IGCM_sys_ncbo 
    2237 #D-* Purpose: encapsulate ncbo call so as to manage error code and retry 
    2238 #D-* Examples: 
    2239 #D- 
    2240 function IGCM_sys_ncbo { 
    2241   IGCM_debug_PushStack "IGCM_sys_ncbo" $@ 
    2242   if ( $DEBUG_sys ) ; then 
    2243     echo "IGCM_sys_ncbo :" $@ 
    2244   fi 
    2245  
    2246   typeset NB_ESSAI DELAI status i 
    2247   # number of tentative 
    2248   NB_ESSAI=3 
    2249   # time delay between tentative 
    2250   DELAI=2 
    2251  
    2252   i=0 
    2253   while [ $i -lt $NB_ESSAI ] ; do 
    2254     ncbo -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2255     status=$? 
    2256     if [ ${status} -gt 0 ] ; then 
    2257       IGCM_debug_Print 2 "IGCM_sys_ncbo : error code ${status}" 
    2258       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2259       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2260       IGCM_debug_Print 2 "IGCM_sys_ncbo : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2261       sleep $DELAI 
    2262     else 
    2263       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2264       break 
    2265     fi 
    2266     (( i = i + 1 )) 
    2267   done 
    2268  
    2269   if [ ${status} -gt 0 ] ; then 
    2270     echo "IGCM_sys_ncbo : ncbo error" 
    2271     IGCM_debug_Exit "ncbo" 
    2272   fi 
    2273  
    2274   IGCM_debug_PopStack "IGCM_sys_ncbo" 
    2275 } 
    2276  
    2277 #D-#================================================== 
    2278 #D-function IGCM_sys_ncdif 
    2279 #D-* Purpose: encapsulate ncdiff call so as to manage error code and retry 
    2280 #D-* Examples: 
    2281 #D- 
    2282 function IGCM_sys_ncdiff { 
    2283   IGCM_debug_PushStack "IGCM_sys_ncdiff" $@ 
    2284   if ( $DEBUG_sys ) ; then 
    2285     echo "IGCM_sys_ncdiff :" $@ 
    2286   fi 
    2287  
    2288   typeset NB_ESSAI DELAI status i 
    2289   # number of tentative 
    2290   NB_ESSAI=3 
    2291   # time delay between tentative 
    2292   DELAI=2 
    2293  
    2294   i=0 
    2295   while [ $i -lt $NB_ESSAI ] ; do 
    2296     ncdiff -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2297     status=$? 
    2298     if [ ${status} -gt 0 ] ; then 
    2299       IGCM_debug_Print 2 "IGCM_sys_ncdiff : error code ${status}" 
    2300       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2301       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2302       IGCM_debug_Print 2 "IGCM_sys_ncdiff : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2303       sleep $DELAI 
    2304     else 
    2305       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2306       break 
    2307     fi 
    2308     (( i = i + 1 )) 
    2309   done 
    2310  
    2311   if [ ${status} -gt 0 ] ; then 
    2312     echo "IGCM_sys_ncdiff : ncdiff error" 
    2313     IGCM_debug_Exit "ncdiff" 
    2314   fi 
    2315  
    2316   IGCM_debug_PopStack "IGCM_sys_ncdiff" 
    2317 } 
    2318  
    2319 #D-#================================================== 
    2320 #D-function IGCM_sys_ncea 
    2321 #D-* Purpose: encapsulate ncea call so as to manage error code and retry 
    2322 #D-* Examples: 
    2323 #D- 
    2324 function IGCM_sys_ncea { 
    2325   IGCM_debug_PushStack "IGCM_sys_ncea" $@ 
    2326   if ( $DEBUG_sys ) ; then 
    2327     echo "IGCM_sys_ncea :" $@ 
    2328   fi 
    2329  
    2330   typeset NB_ESSAI DELAI status i 
    2331   # number of tentative 
    2332   NB_ESSAI=3 
    2333   # time delay between tentative 
    2334   DELAI=2 
    2335  
    2336   i=0 
    2337   while [ $i -lt $NB_ESSAI ] ; do 
    2338     ncea -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2339     status=$? 
    2340     if [ ${status} -gt 0 ] ; then 
    2341       IGCM_debug_Print 2 "IGCM_sys_ncea : error code ${status}" 
    2342       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2343       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2344       IGCM_debug_Print 2 "IGCM_sys_ncea : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2345       sleep $DELAI 
    2346     else 
    2347       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2348       break 
    2349     fi 
    2350     (( i = i + 1 )) 
    2351   done 
    2352  
    2353   if [ ${status} -gt 0 ] ; then 
    2354     echo "IGCM_sys_ncea : ncea error" 
    2355     IGCM_debug_Exit "ncea" 
    2356   fi 
    2357  
    2358   IGCM_debug_PopStack "IGCM_sys_ncea" 
    2359 } 
    2360  
    2361 #D-#================================================== 
    2362 #D-function IGCM_sys_ncecat 
    2363 #D-* Purpose: encapsulate ncecat call so as to manage error code and retry 
    2364 #D-* Examples: 
    2365 #D- 
    2366 function IGCM_sys_ncecat { 
    2367   IGCM_debug_PushStack "IGCM_sys_ncecat" $@ 
    2368   if ( $DEBUG_sys ) ; then 
    2369     echo "IGCM_sys_ncecat :" $@ 
    2370   fi 
    2371  
    2372   typeset NB_ESSAI DELAI status i 
    2373   # number of tentative 
    2374   NB_ESSAI=3 
    2375   # time delay between tentative 
    2376   DELAI=2 
    2377  
    2378   i=0 
    2379   while [ $i -lt $NB_ESSAI ] ; do 
    2380     ncecat -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2381     status=$? 
    2382     if [ ${status} -gt 0 ] ; then 
    2383       IGCM_debug_Print 2 "IGCM_sys_ncecat : error code ${status}" 
    2384       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2385       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2386       IGCM_debug_Print 2 "IGCM_sys_ncecat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2387       sleep $DELAI 
    2388     else 
    2389       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2390       break 
    2391     fi 
    2392     (( i = i + 1 )) 
    2393   done 
    2394  
    2395   if [ ${status} -gt 0 ] ; then 
    2396     echo "IGCM_sys_ncecat : ncecat error" 
    2397     IGCM_debug_Exit "ncecat" 
    2398   fi 
    2399  
    2400   IGCM_debug_PopStack "IGCM_sys_ncecat" 
    2401 } 
    2402  
    2403 #D-#================================================== 
    2404 #D-function IGCM_sys_ncflint 
    2405 #D-* Purpose: encapsulate ncflint call so as to manage error code and retry 
    2406 #D-* Examples: 
    2407 #D- 
    2408 function IGCM_sys_ncflint { 
    2409   IGCM_debug_PushStack "IGCM_sys_ncflint" $@ 
    2410   if ( $DEBUG_sys ) ; then 
    2411     echo "IGCM_sys_ncflint :" $@ 
    2412   fi 
    2413  
    2414   typeset NB_ESSAI DELAI status i 
    2415   # number of tentative 
    2416   NB_ESSAI=3 
    2417   # time delay between tentative 
    2418   DELAI=2 
    2419  
    2420   i=0 
    2421   while [ $i -lt $NB_ESSAI ] ; do 
    2422     ncflint -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2423     status=$? 
    2424     if [ ${status} -gt 0 ] ; then 
    2425       IGCM_debug_Print 2 "IGCM_sys_ncflint : error code ${status}" 
    2426       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2427       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2428       IGCM_debug_Print 2 "IGCM_sys_ncflint : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2429       sleep $DELAI 
    2430     else 
    2431       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2432       break 
    2433     fi 
    2434     (( i = i + 1 )) 
    2435   done 
    2436  
    2437   if [ ${status} -gt 0 ] ; then 
    2438     echo "IGCM_sys_ncflint : ncflint error" 
    2439     IGCM_debug_Exit "ncflint" 
    2440   fi 
    2441  
    2442   IGCM_debug_PopStack "IGCM_sys_ncflint" 
    2443 } 
    2444  
    2445 #D-#================================================== 
    2446 #D-function IGCM_sys_ncks 
    2447 #D-* Purpose: encapsulate ncks call so as to manage error code and retry 
    2448 #D-* Examples: 
    2449 #D- 
    2450 function IGCM_sys_ncks { 
    2451   IGCM_debug_PushStack "IGCM_sys_ncks" $@ 
    2452   if ( $DEBUG_sys ) ; then 
    2453     echo "IGCM_sys_ncks :" $@ 
    2454   fi 
    2455  
    2456   typeset NB_ESSAI DELAI status i 
    2457   # number of tentative 
    2458   NB_ESSAI=3 
    2459   # time delay between tentative 
    2460   DELAI=2 
    2461  
    2462   i=0 
    2463   while [ $i -lt $NB_ESSAI ] ; do 
    2464     ncks -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2465     status=$? 
    2466     if [ ${status} -gt 0 ] ; then 
    2467       IGCM_debug_Print 2 "IGCM_sys_ncks : error code ${status}" 
    2468       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2469       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2470       IGCM_debug_Print 2 "IGCM_sys_ncks : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2471       sleep $DELAI 
    2472     else 
    2473       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2474       break 
    2475     fi 
    2476     (( i = i + 1 )) 
    2477   done 
    2478  
    2479   if [ ${status} -gt 0 ] ; then 
    2480     echo "IGCM_sys_ncks : ncks error" 
    2481     IGCM_debug_Exit "ncks" 
    2482   fi 
    2483  
    2484   IGCM_debug_PopStack "IGCM_sys_ncks" 
    2485 } 
    2486  
    2487 #D-#================================================== 
    2488 #D-function IGCM_sys_ncpdq 
    2489 #D-* Purpose: encapsulate ncpdq call so as to manage error code and retry 
    2490 #D-* Examples: 
    2491 #D- 
    2492 function IGCM_sys_ncpdq { 
    2493   IGCM_debug_PushStack "IGCM_sys_ncpdq" $@ 
    2494   if ( $DEBUG_sys ) ; then 
    2495     echo "IGCM_sys_ncpdq :" $@ 
    2496   fi 
    2497  
    2498   typeset NB_ESSAI DELAI status i 
    2499   # number of tentative 
    2500   NB_ESSAI=3 
    2501   # time delay between tentative 
    2502   DELAI=2 
    2503  
    2504   i=0 
    2505   while [ $i -lt $NB_ESSAI ] ; do 
    2506     ncpdq -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2507     status=$? 
    2508     if [ ${status} -gt 0 ] ; then 
    2509       IGCM_debug_Print 2 "IGCM_sys_ncpdq : error code ${status}" 
    2510       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2511       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2512       IGCM_debug_Print 2 "IGCM_sys_ncpdq : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2513       sleep $DELAI 
    2514     else 
    2515       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2516       break 
    2517     fi 
    2518     (( i = i + 1 )) 
    2519   done 
    2520  
    2521   if [ ${status} -gt 0 ] ; then 
    2522     echo "IGCM_sys_ncpdq : ncpdq error" 
    2523     IGCM_debug_Exit "ncpdq" 
    2524   fi 
    2525  
    2526   IGCM_debug_PopStack "IGCM_sys_ncpdq" 
    2527 } 
    2528  
    2529 #D-#================================================== 
    2530 #D-function IGCM_sys_ncra 
    2531 #D-* Purpose: encapsulate ncra call so as to manage error code and retry 
    2532 #D-* Examples: 
    2533 #D- 
    2534 function IGCM_sys_ncra { 
    2535   IGCM_debug_PushStack "IGCM_sys_ncra" $@ 
    2536   if ( $DEBUG_sys ) ; then 
    2537     echo "IGCM_sys_ncra :" $@ 
    2538   fi 
    2539  
    2540   typeset NB_ESSAI DELAI status i 
    2541   # number of tentative 
    2542   NB_ESSAI=3 
    2543   # time delay between tentative 
    2544   DELAI=2 
    2545  
    2546   i=0 
    2547   while [ $i -lt $NB_ESSAI ] ; do 
    2548     ncra -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2549     status=$? 
    2550     if [ ${status} -gt 0 ] ; then 
    2551       IGCM_debug_Print 2 "IGCM_sys_ncra : error code ${status}" 
    2552       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2553       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2554       IGCM_debug_Print 2 "IGCM_sys_ncra : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2555       sleep $DELAI 
    2556     else 
    2557       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2558       break 
    2559     fi 
    2560     (( i = i + 1 )) 
    2561   done 
    2562  
    2563   if [ ${status} -gt 0 ] ; then 
    2564     echo "IGCM_sys_ncra : ncra error" 
    2565     IGCM_debug_Exit "ncra" 
    2566   fi 
    2567  
    2568   IGCM_debug_PopStack "IGCM_sys_ncra" 
    2569 } 
    2570  
    2571 #D-#================================================== 
    2572 #D-function IGCM_sys_ncrcat 
    2573 #D-* Purpose: encapsulate ncrcat call so as to manage error code and retry 
    2574 #D-* Examples: 
    2575 #D- 
    2576 function IGCM_sys_ncrcat { 
    2577   IGCM_debug_PushStack "IGCM_sys_ncrcat" $@ 
    2578   if ( $DEBUG_sys ) ; then 
    2579     echo "IGCM_sys_ncrcat :" $@ 
    2580   fi 
    2581  
    2582   typeset NB_ESSAI DELAI status i lastArg 
    2583   # number of tentative 
    2584   NB_ESSAI=3 
    2585   # time delay between tentative 
    2586   DELAI=2 
    2587  
    2588   i=0 
    2589   while [ $i -lt $NB_ESSAI ] ; do 
    2590     ncrcat -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2591     status=$? 
    2592     if [ ${status} -gt 0 ] ; then 
    2593       IGCM_debug_Print 2 "IGCM_sys_ncrcat : error code ${status}" 
    2594       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2595       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2596       IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2597       sleep $DELAI 
    2598     elif [ ! "X$( grep "WARNING Intra-file non-monotonicity" ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ )" = "X" ] ; then 
    2599       IGCM_debug_Print 2 "IGCM_sys_ncrcat : WARNING Intra-file non-monotonicity" 
    2600       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2601       # remove files having corrupted time axis 
    2602       eval lastArg=\${$#} 
    2603       IGCM_debug_Print 2 "IGCM_sys_ncrcat : Delete ${lastArg}" 
    2604       \rm ${lastArg} 
    2605       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2606       IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2607       sleep $DELAI 
    2608     else 
    2609       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2610       break 
    2611     fi 
    2612     (( i = i + 1 )) 
    2613   done 
    2614  
    2615   if [ ${status} -gt 0 ] ; then 
    2616     echo "IGCM_sys_ncrcat : ncrcat error" 
    2617     #IGCM_debug_Exit "ncrcat" 
    2618   fi 
    2619  
    2620   IGCM_debug_PopStack "IGCM_sys_ncrcat" 
    2621 } 
    2622  
    2623 #D-#================================================== 
    2624 #D-function IGCM_sys_ncrename 
    2625 #D-* Purpose: encapsulate ncrename call so as to manage error code and retry 
    2626 #D-* Examples: 
    2627 #D- 
    2628 function IGCM_sys_ncrename { 
    2629   IGCM_debug_PushStack "IGCM_sys_ncrename" $@ 
    2630   if ( $DEBUG_sys ) ; then 
    2631     echo "IGCM_sys_ncrename :" $@ 
    2632   fi 
    2633  
    2634   typeset NB_ESSAI DELAI status i 
    2635   # number of tentative 
    2636   NB_ESSAI=3 
    2637   # time delay between tentative 
    2638   DELAI=2 
    2639  
    2640   i=0 
    2641   while [ $i -lt $NB_ESSAI ] ; do 
    2642     ncrename $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2643     status=$? 
    2644     if [ ${status} -gt 0 ] ; then 
    2645       IGCM_debug_Print 2 "IGCM_sys_ncrename : error code ${status}" 
    2646       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2647       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2648       IGCM_debug_Print 2 "IGCM_sys_ncrename : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2649       sleep $DELAI 
    2650     else 
    2651       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2652       break 
    2653     fi 
    2654     (( i = i + 1 )) 
    2655   done 
    2656  
    2657   if [ ${status} -gt 0 ] ; then 
    2658     echo "IGCM_sys_ncrename : ncrename error" 
    2659     IGCM_debug_Exit "ncrename" 
    2660   fi 
    2661  
    2662   IGCM_debug_PopStack "IGCM_sys_ncrename" 
    2663 } 
    2664  
    2665 #D-#================================================== 
    2666 #D-function IGCM_sys_ncwa 
    2667 #D-* Purpose: encapsulate ncwa call so as to manage error code and retry 
    2668 #D-* Examples: 
    2669 #D- 
    2670 function IGCM_sys_ncwa { 
    2671   IGCM_debug_PushStack "IGCM_sys_ncwa" $@ 
    2672   if ( $DEBUG_sys ) ; then 
    2673     echo "IGCM_sys_ncwa :" $@ 
    2674   fi 
    2675  
    2676   typeset NB_ESSAI DELAI status i 
    2677   # number of tentative 
    2678   NB_ESSAI=3 
    2679   # time delay between tentative 
    2680   DELAI=2 
    2681  
    2682   i=0 
    2683   while [ $i -lt $NB_ESSAI ] ; do 
    2684     ncwa -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2685     status=$? 
    2686     if [ ${status} -gt 0 ] ; then 
    2687       IGCM_debug_Print 2 "IGCM_sys_ncwa : error code ${status}" 
    2688       cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2689       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2690       IGCM_debug_Print 2 "IGCM_sys_ncwa : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    2691       sleep $DELAI 
    2692     else 
    2693       \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2694       break 
    2695     fi 
    2696     (( i = i + 1 )) 
    2697   done 
    2698  
    2699   if [ ${status} -gt 0 ] ; then 
    2700     echo "IGCM_sys_ncwa : ncwa error" 
    2701     IGCM_debug_Exit "ncwa" 
    2702   fi 
    2703  
    2704   IGCM_debug_PopStack "IGCM_sys_ncwa" 
    2705 } 
    2706  
    2707 ############################################################## 
    2708 # CDO OPERATOR 
    2709  
    2710 #D-#================================================== 
    2711 #D-function IGCM_sys_cdo 
    2712 #D-* Purpose: encapsulate cdo call so as to manage error code and retry 
    2713 #D-* Examples: 
    2714 #D- 
    2715 function IGCM_sys_cdo { 
    2716   IGCM_debug_PushStack "IGCM_sys_cdo" $@ 
    2717   if ( $DEBUG_sys ) ; then 
    2718     echo "IGCM_sys_cdo :" $@ 
    2719   fi 
    2720  
    2721   typeset status 
    2722  
    2723   \cdo $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    2724   status=$? 
    2725   if [ ${status} -gt 0 ] ; then 
    2726     echo "IGCM_sys_cdo : error code ${status}" 
    2727     cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2728     \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    2729     IGCM_debug_PopStack "IGCM_sys_cdo" 
    2730     return 1 
    2731   else 
    2732     IGCM_debug_PopStack "IGCM_sys_cdo" 
    2733     return 0 
    2734   fi 
    2735  
    2736   IGCM_debug_PopStack "IGCM_sys_cdo" 
    2737 } 
Note: See TracChangeset for help on using the changeset viewer.