Changeset 811


Ignore:
Timestamp:
03/05/13 15:39:16 (11 years ago)
Author:
sdipsl
Message:
  • see #104 homegenize sys lib so as to ease maintenance.
  • all sys lib must have the same functions (some of them being dummy or not) depending on centre environment
  • indentation clean-up (from emacs macro)
Location:
trunk/libIGCM/libIGCM_sys
Files:
5 edited

Legend:

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

    r809 r811  
    251251    echo "IGCM_sys_RshPost :" $@ 
    252252  fi 
    253  
    254   # keep standard input to keep it for postpone if ulam don't answer 
     253  # keep standard input (stdin) for the loop onto temporary file 
    255254  cat >/tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
    256255 
     
    627626  IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 
    628627 
    629   typeset ERROR 
    630   ERROR=0 
     628  typeset status 
    631629 
    632630  if ( $DEBUG_sys ) ; then 
     
    639637      -e "s:\# \@ error *= .*:\# \@ error = ${Script_Output}:"   \ 
    640638      $1 > ${REP_FOR_JOB}/JOB_FOR_IGCM 
    641   cd $REP_FOR_JOB ; /usr/bin/llsubmit JOB_FOR_IGCM ; ERROR=$? ; cd - ; 
    642  
    643   if [ ${ERROR} -gt 0 ] ; then 
    644     echo "IGCM_sys_Qsub : erreur $@" 
     639  cd $REP_FOR_JOB ; /usr/bin/llsubmit JOB_FOR_IGCM ; status=$? ; cd - ; 
     640 
     641  if [ ${status} -gt 0 ] ; then 
     642    IGCM_debug_Print 2 "IGCM_sys_Qsub $1 : error code ${status}" 
    645643    IGCM_debug_Exit "IGCM_sys_Qsub" 
    646644  else 
     
    658656  IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 
    659657 
    660   typeset ERROR 
    661   ERROR=0 
     658  typeset status 
    662659 
    663660  if ( $DEBUG_sys ) ; then 
     
    672669      ${libIGCM_POST}/$1.job > ${REP_FOR_JOB}/JOB_FOR_IGCM 
    673670 
    674   cd $REP_FOR_JOB ; /usr/bin/llsubmit JOB_FOR_IGCM ; ERROR=$? ; cd - ; 
    675   if [ ${ERROR} -gt 0 ] ; then 
    676     echo "IGCM_sys_QsubPost : erreur $@." 
     671  cd $REP_FOR_JOB ; /usr/bin/llsubmit JOB_FOR_IGCM ; status=$? ; cd - ; 
     672  if [ ${status} -gt 0 ] ; then 
     673    IGCM_debug_Print 2 "IGCM_sys_QsubPost $1 : error code ${status}" 
    677674    IGCM_debug_Exit "IGCM_sys_QsubPost" 
    678675  else 
    679676    IGCM_sys_Rm ${REP_FOR_JOB}/JOB_FOR_IGCM 
    680677  fi 
    681  
    682678  IGCM_debug_PopStack "IGCM_sys_QsubPost" 
    683679} 
     
    800796#D-#================================================== 
    801797#D-function IGCM_sys_Miror_libIGCM 
    802 #D-* Purpose: Mirror libIGCM PATH and lib to ulam 
     798#D-* Purpose: Mirror libIGCM PATH and lib to frontend 
    803799#D-* Examples: 
    804800#D- 
     
    818814 
    819815  if [ ${status} -gt 0 ] ; then 
    820     echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium." 
     816    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend." 
    821817    cat out_rsync 
    822818  fi 
     
    12141210  fi 
    12151211  echo $( basename $1 ) 
    1216  
    12171212  IGCM_debug_PopStack "IGCM_sys_PrepareTaredRestart" 
    12181213} 
     
    16151610# REBUILD OPERATOR 
    16161611 
     1612#D-#================================================== 
     1613#D-function IGCM_sys_rebuild 
     1614#D-* Purpose: rebuild parallel files 
     1615#D-* Examples: 
     1616#D- 
    16171617function IGCM_sys_rebuild { 
    16181618  IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 
     
    16541654} 
    16551655 
     1656#D-#================================================== 
     1657#D-function IGCM_sys_rebuild_station 
     1658#D-* Purpose: rebuild parallel files describing station  
     1659#D-* Examples: 
     1660#D- 
    16561661function IGCM_sys_rebuild_station { 
    16571662  IGCM_debug_PushStack "IGCM_sys_rebuild_station" -- $@ 
     
    17481753# Activate Running Environnment Variables 
    17491754 
     1755#D-#================================================== 
     1756#D-function IGCM_sys_desactiv_variables 
     1757#D-* Purpose: set environement variables prior to execution 
     1758#D-* Examples: 
     1759#D- 
    17501760function IGCM_sys_activ_variables { 
    17511761  IGCM_debug_PushStack "IGCM_sys_activ_variables" 
    17521762  if ( $DEBUG_sys ) ; then 
    1753     echo "IGCM_sys_activ_variables " 
    1754   fi 
     1763    echo "IGCM_sys_activ_variables" 
     1764  fi 
     1765 
     1766# -------------------------------------------------------------------- 
     1767#D- MPI specifications 
     1768# -------------------------------------------------------------------- 
     1769 
     1770# -------------------------------------------------------------------- 
     1771#D- Other specifications 
     1772# -------------------------------------------------------------------- 
    17551773 
    17561774  ulimit -s unlimited 
     
    17671785# Desactivate Running Environnment Variables 
    17681786 
     1787#D-#================================================== 
     1788#D-function IGCM_sys_desactiv_variables 
     1789#D-* Purpose: unset environement variables after execution 
     1790#D-* Examples: 
     1791#D- 
    17691792function IGCM_sys_desactiv_variables { 
    17701793  IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 
    17711794  if ( $DEBUG_sys ) ; then 
    1772     echo "IGCM_sys_desactiv_variables " 
     1795    echo "IGCM_sys_desactiv_variables" 
    17731796  fi 
    17741797# -------------------------------------------------------------------- 
     
    17861809# Build MPI/OMP scripts run file (dummy function) 
    17871810 
     1811#D-#================================================== 
     1812#D-function IGCM_sys_build_run_file 
     1813#D-* Purpose: build run file (deprecated) 
     1814#D-* Examples: 
     1815#D- 
    17881816function IGCM_sys_build_run_file { 
    17891817 
    1790 IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 
     1818  IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 
    17911819 
    17921820} 
     
    17941822############################################################ 
    17951823# Build MPI/OMP scripts 
     1824 
     1825#D-#================================================== 
     1826#D-function IGCM_sys_build_execution_scripts 
     1827#D-* Purpose: build execution scripts to be launch by ${HOST_MPIRUN_COMMAND} 
     1828#D-* Examples: 
     1829#D- 
    17961830function IGCM_sys_build_execution_scripts 
    17971831{ 
     
    18731907  else # Only one executable. launch it. 
    18741908 
    1875     # 
    18761909    for comp in ${config_ListOfComponents[*]} ; do 
    18771910 
     
    18931926 
    18941927############################################################ 
    1895 # Check of space available on temporary filesytems 
     1928# Check of space available on temporary filesytems. 
     1929 
     1930#D-#================================================== 
     1931#D-function IGCM_sys_check_quota 
     1932#D-* Purpose: check user quota. Stop the simulation if quota above 90% 
     1933#D-* Examples: 
     1934#D- 
    18961935function IGCM_sys_check_quota { 
    18971936  IGCM_debug_PushStack "IGCM_sys_check_quota" 
    18981937  if ( $DEBUG_sys ) ; then 
    1899     echo "IGCM_sys_check_quota " 
     1938    echo "IGCM_sys_check_quota" 
    19001939  fi 
    19011940  # Limit of quota (in %) 
    19021941  limit_quota=90 
     1942 
    19031943  # Check of the volume 
    19041944  volume_quota=$(quota_u -w | grep 'Quota soft' | awk '{print $5}') 
     
    19251965#D-* Examples: IGCM_sys_CountJobInQueue ${JobName} NbRun 
    19261966#D- 
    1927  
    19281967function IGCM_sys_CountJobInQueue { 
    19291968  IGCM_debug_PushStack "IGCM_sys_CountJobInQueue" 
     
    19431982# NCO OPERATOR 
    19441983 
     1984#D-#================================================== 
     1985#D-function IGCM_sys_ncap2 
     1986#D-* Purpose: encapsulate ncap2 call so as to manage error code and retry 
     1987#D-* Examples: 
     1988#D- 
    19451989function IGCM_sys_ncap2 { 
    19461990  IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 
     
    19732017 
    19742018  if [ ${status} -gt 0 ] ; then 
    1975       echo "IGCM_sys_ncap2 : ncap2 error" 
    1976       IGCM_debug_Exit "ncap2" 
     2019    echo "IGCM_sys_ncap2 : ncap2 error" 
     2020    IGCM_debug_Exit "ncap2" 
    19772021  fi 
    19782022 
     
    19802024} 
    19812025 
     2026#D-#================================================== 
     2027#D-function IGCM_sys_ncatted 
     2028#D-* Purpose: encapsulate ncatted call so as to manage error code and retry 
     2029#D-* Examples: 
     2030#D- 
    19822031function IGCM_sys_ncatted { 
    19832032  IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 
     
    20102059 
    20112060  if [ ${status} -gt 0 ] ; then 
    2012       echo "IGCM_sys_ncatted : ncatted error" 
    2013       IGCM_debug_Exit "ncatted" 
     2061    echo "IGCM_sys_ncatted : ncatted error" 
     2062    IGCM_debug_Exit "ncatted" 
    20142063  fi 
    20152064 
     
    20172066} 
    20182067 
     2068#D-#================================================== 
     2069#D-function IGCM_sys_ncbo 
     2070#D-* Purpose: encapsulate ncbo call so as to manage error code and retry 
     2071#D-* Examples: 
     2072#D- 
    20192073function IGCM_sys_ncbo { 
    20202074  IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 
     
    20472101 
    20482102  if [ ${status} -gt 0 ] ; then 
    2049       echo "IGCM_sys_ncbo : ncbo error" 
    2050       IGCM_debug_Exit "ncbo" 
     2103    echo "IGCM_sys_ncbo : ncbo error" 
     2104    IGCM_debug_Exit "ncbo" 
    20512105  fi 
    20522106 
     
    20542108} 
    20552109 
     2110#D-#================================================== 
     2111#D-function IGCM_sys_ncdif 
     2112#D-* Purpose: encapsulate ncdiff call so as to manage error code and retry 
     2113#D-* Examples: 
     2114#D- 
    20562115function IGCM_sys_ncdiff { 
    20572116  IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 
     
    20842143 
    20852144  if [ ${status} -gt 0 ] ; then 
    2086       echo "IGCM_sys_ncdiff : ncdiff error" 
    2087       IGCM_debug_Exit "ncdiff" 
     2145    echo "IGCM_sys_ncdiff : ncdiff error" 
     2146    IGCM_debug_Exit "ncdiff" 
    20882147  fi 
    20892148 
     
    20912150} 
    20922151 
     2152#D-#================================================== 
     2153#D-function IGCM_sys_ncea 
     2154#D-* Purpose: encapsulate ncea call so as to manage error code and retry 
     2155#D-* Examples: 
     2156#D- 
    20932157function IGCM_sys_ncea { 
    20942158  IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 
     
    21212185 
    21222186  if [ ${status} -gt 0 ] ; then 
    2123       echo "IGCM_sys_ncea : ncea error" 
    2124       IGCM_debug_Exit "ncea" 
     2187    echo "IGCM_sys_ncea : ncea error" 
     2188    IGCM_debug_Exit "ncea" 
    21252189  fi 
    21262190 
     
    21282192} 
    21292193 
     2194#D-#================================================== 
     2195#D-function IGCM_sys_ncecat 
     2196#D-* Purpose: encapsulate ncecat call so as to manage error code and retry 
     2197#D-* Examples: 
     2198#D- 
    21302199function IGCM_sys_ncecat { 
    21312200  IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 
     
    21582227 
    21592228  if [ ${status} -gt 0 ] ; then 
    2160       echo "IGCM_sys_ncecat : ncecat error" 
    2161       IGCM_debug_Exit "ncecat" 
     2229    echo "IGCM_sys_ncecat : ncecat error" 
     2230    IGCM_debug_Exit "ncecat" 
    21622231  fi 
    21632232 
     
    21652234} 
    21662235 
     2236#D-#================================================== 
     2237#D-function IGCM_sys_ncflint 
     2238#D-* Purpose: encapsulate ncflint call so as to manage error code and retry 
     2239#D-* Examples: 
     2240#D- 
    21672241function IGCM_sys_ncflint { 
    21682242  IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 
     
    21952269 
    21962270  if [ ${status} -gt 0 ] ; then 
    2197       echo "IGCM_sys_ncflint : ncflint error" 
    2198       IGCM_debug_Exit "ncflint" 
     2271    echo "IGCM_sys_ncflint : ncflint error" 
     2272    IGCM_debug_Exit "ncflint" 
    21992273  fi 
    22002274 
     
    22022276} 
    22032277 
     2278#D-#================================================== 
     2279#D-function IGCM_sys_ncks 
     2280#D-* Purpose: encapsulate ncks call so as to manage error code and retry 
     2281#D-* Examples: 
     2282#D- 
    22042283function IGCM_sys_ncks { 
    22052284  IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 
     
    22322311 
    22332312  if [ ${status} -gt 0 ] ; then 
    2234       echo "IGCM_sys_ncks : ncks error" 
    2235       IGCM_debug_Exit "ncks" 
     2313    echo "IGCM_sys_ncks : ncks error" 
     2314    IGCM_debug_Exit "ncks" 
    22362315  fi 
    22372316 
     
    22392318} 
    22402319 
     2320#D-#================================================== 
     2321#D-function IGCM_sys_ncpdq 
     2322#D-* Purpose: encapsulate ncpdq call so as to manage error code and retry 
     2323#D-* Examples: 
     2324#D- 
    22412325function IGCM_sys_ncpdq { 
    22422326  IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 
     
    22692353 
    22702354  if [ ${status} -gt 0 ] ; then 
    2271       echo "IGCM_sys_ncpdq : ncpdq error" 
    2272       IGCM_debug_Exit "ncpdq" 
     2355    echo "IGCM_sys_ncpdq : ncpdq error" 
     2356    IGCM_debug_Exit "ncpdq" 
    22732357  fi 
    22742358 
     
    22762360} 
    22772361 
     2362#D-#================================================== 
     2363#D-function IGCM_sys_ncra 
     2364#D-* Purpose: encapsulate ncra call so as to manage error code and retry 
     2365#D-* Examples: 
     2366#D- 
    22782367function IGCM_sys_ncra { 
    22792368  IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 
     
    23062395 
    23072396  if [ ${status} -gt 0 ] ; then 
    2308       echo "IGCM_sys_ncra : ncra error" 
    2309       IGCM_debug_Exit "ncra" 
     2397    echo "IGCM_sys_ncra : ncra error" 
     2398    IGCM_debug_Exit "ncra" 
    23102399  fi 
    23112400 
     
    23132402} 
    23142403 
     2404#D-#================================================== 
     2405#D-function IGCM_sys_ncrcat 
     2406#D-* Purpose: encapsulate ncrcat call so as to manage error code and retry 
     2407#D-* Examples: 
     2408#D- 
    23152409function IGCM_sys_ncrcat { 
    23162410  IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 
     
    23532447 
    23542448  if [ ${status} -gt 0 ] ; then 
    2355       echo "IGCM_sys_ncrcat : ncrcat error" 
    2356       #IGCM_debug_Exit "ncrcat" 
     2449    echo "IGCM_sys_ncrcat : ncrcat error" 
     2450    #IGCM_debug_Exit "ncrcat" 
    23572451  fi 
    23582452 
     
    23602454} 
    23612455 
     2456#D-#================================================== 
     2457#D-function IGCM_sys_ncrename 
     2458#D-* Purpose: encapsulate ncrename call so as to manage error code and retry 
     2459#D-* Examples: 
     2460#D- 
    23622461function IGCM_sys_ncrename { 
    23632462  IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 
     
    23902489 
    23912490  if [ ${status} -gt 0 ] ; then 
    2392       echo "IGCM_sys_ncrename : ncrename error" 
    2393       IGCM_debug_Exit "ncrename" 
     2491    echo "IGCM_sys_ncrename : ncrename error" 
     2492    IGCM_debug_Exit "ncrename" 
    23942493  fi 
    23952494 
     
    23972496} 
    23982497 
     2498#D-#================================================== 
     2499#D-function IGCM_sys_ncwa 
     2500#D-* Purpose: encapsulate ncwa call so as to manage error code and retry 
     2501#D-* Examples: 
     2502#D- 
    23992503function IGCM_sys_ncwa { 
    24002504  IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 
     
    24272531 
    24282532  if [ ${status} -gt 0 ] ; then 
    2429       echo "IGCM_sys_ncwa : ncwa error" 
    2430       IGCM_debug_Exit "ncwa" 
     2533    echo "IGCM_sys_ncwa : ncwa error" 
     2534    IGCM_debug_Exit "ncwa" 
    24312535  fi 
    24322536 
     
    24372541# CDO OPERATOR 
    24382542 
     2543#D-#================================================== 
     2544#D-function IGCM_sys_cdo 
     2545#D-* Purpose: encapsulate cdo call so as to manage error code and retry 
     2546#D-* Examples: 
     2547#D- 
    24392548function IGCM_sys_cdo { 
    24402549  IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh

    r809 r811  
    248248    ${@} 
    249249EOF 
    250   if [ $? -gt 0 ] ; then 
    251     echo "IGCM_sys_RshArchive : erreur." 
     250  status=$? 
     251  if [ ${status} -gt 0 ] ; then 
     252    IGCM_debug_Print 2 "IGCM_sys_RshArchive : command failed error code ${status}" 
    252253    IGCM_debug_Exit "IGCM_sys_RshArchive" 
    253254  fi 
     
    265266    echo "IGCM_sys_RshPost :" $@ 
    266267  fi 
    267  
    268   #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL 
    269   #cat tmp_IGCM_sys_RshPost_$$ 
    270268  # keep standard input (stdin) for the loop onto temporary file 
    271   cat >tmp_IGCM_sys_RshPost_$$ 
    272  
    273 # ============ FRONTEND START ============ # 
    274  
    275   /bin/ksh <tmp_IGCM_sys_RshPost_$$ 
     269  cat >/tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
     270 
     271  /bin/ksh </tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
    276272  if [ $? -gt 0 ] ; then 
    277273    echo "IGCM_sys_RshPost : erreur." 
     
    279275  fi 
    280276  # delete temporary file 
    281   \rm tmp_IGCM_sys_RshPost_$$ 
     277  \rm /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
    282278 
    283279# ============ FRONTEND  END  ============ # 
     
    372368    mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 
    373369  fi 
     370 
    374371  sleep 10 
    375372  rm -f job_end.mail 
    376    
     373 
    377374  if [ $? -gt 0 ] ; then 
    378375    echo "IGCM_sys_SendMail : erreur." 
     
    420417  if [ ! -d ${1} ]; then 
    421418    \mkdir -p $1 
    422     if [ $? -gt 0 ] ; then 
    423       echo "IGCM_sys_MkdirArchive : erreur." 
     419    status=$? 
     420 
     421    if [ ${status} -gt 0 ] ; then 
     422      IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}" 
    424423      IGCM_debug_Exit "IGCM_sys_MkdirArchive" 
    425424    fi 
     
    533532  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 
    534533  IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 
    535  
    536534  return ${ExistFlag} 
    537535} 
     
    672670    echo "IGCM_sys_Qsub :" $@ 
    673671  fi 
    674   typeset options 
     672  typeset options status 
    675673  if [ ${config_UserChoices_JobName}.${CumulPeriod} = "." ] ; then 
    676674    options=" -o ${Script_Output} -e ${Script_Output}" 
     
    680678 
    681679  /usr/bin/ccc_msub ${options} < $1 
    682   if [ $? -gt 0 ] ; then 
    683     echo "IGCM_sys_Qsub : erreur ${options} $1" 
     680  status=$? 
     681  if [ ${status} -gt 0 ] ; then 
     682    IGCM_debug_Print 2 "IGCM_sys_Qsub ${options} $1 : error code ${status}" 
    684683    IGCM_debug_Exit "IGCM_sys_Qsub" 
    685684  fi 
     
    697696    echo "IGCM_sys_QsubPost :" $@ 
    698697  fi 
     698  typeset status 
    699699  MY_PROJECT=$(echo ${BRIDGE_MSUB_PROJECT} | cut -d@ -f1 ) 
    700700  /usr/bin/ccc_msub -Q normal -A ${MY_PROJECT} -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.out ${libIGCM_POST}/$1.job 
    701   if [ $? -gt 0 ] ; then 
    702     echo "IGCM_sys_QsubPost : erreur " $@ 
     701  status=$? 
     702  if [ ${status} -gt 0 ] ; then 
     703    IGCM_debug_Print 2 "IGCM_sys_QsubPost $1 : error code ${status}" 
    703704    IGCM_debug_Exit "IGCM_sys_QsubPost" 
    704705  fi 
     
    823824#D-#================================================== 
    824825#D-function IGCM_sys_Miror_libIGCM 
    825 #D-* Purpose: Mirror libIGCM PATH and lib to cesium 
     826#D-* Purpose: Mirror libIGCM PATH and lib to frontend 
    826827#D-* Examples: 
    827828#D- 
     
    841842 
    842843  if [ ${status} -gt 0 ] ; then 
    843     echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium." 
     844    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend." 
    844845    cat out_rsync 
    845846  fi 
     
    920921 
    921922  if [ ${status} -gt 0 ] ; then 
    922     echo "IGCM_sys_RmRunDir : error code ${status}" 
     923    echo "IGCM_sys_RmRunDir : rm error code is ${status}." 
    923924    cat out_rsync 
    924925    IGCM_debug_Exit "IGCM_sys_RmRunDir" 
     
    989990 
    990991    if [ ${status} -gt 0 ] ; then 
    991       echo "IGCM_sys_Put_Dir : error code ${status}" 
     992      IGCM_debug_Print 2 "IGCM_sys_Put_Dir : cp failed error code ${status}" 
    992993      cat out_rsync 
    993994      IGCM_debug_Exit "IGCM_sys_Put_Dir" 
     
    10351036      \cp -ur $1 $2 >> out_rsync 2>&1 
    10361037      status=$? 
    1037       if [ ${status} -gt 0 ]; then 
     1038      if [ ${status} -gt 0 ] ; then 
    10381039        IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status} ${i}/${NB_ESSAI}" 
    10391040        IGCM_debug_Print 2 "IGCM_sys_Get_Dir : sleep ${DELAI} seconds and try again." 
     
    13891390      if [ "X$( diff $1 $2 )" = X ] ; then 
    13901391        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 
     1392        status=0 
    13911393        skip=true 
    13921394      else 
     
    18351837# REBUILD OPERATOR 
    18361838 
     1839#D-#================================================== 
     1840#D-function IGCM_sys_rebuild 
     1841#D-* Purpose: rebuild parallel files 
     1842#D-* Examples: 
     1843#D- 
    18371844function IGCM_sys_rebuild { 
    18381845  IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 
     
    18741881} 
    18751882 
     1883#D-#================================================== 
     1884#D-function IGCM_sys_rebuild_station 
     1885#D-* Purpose: rebuild parallel files describing station  
     1886#D-* Examples: 
     1887#D- 
    18761888function IGCM_sys_rebuild_station { 
    18771889  IGCM_debug_PushStack "IGCM_sys_rebuild_station" -- $@ 
     
    19681980# Activate Running Environnment Variables 
    19691981 
     1982#D-#================================================== 
     1983#D-function IGCM_sys_desactiv_variables 
     1984#D-* Purpose: set environement variables prior to execution 
     1985#D-* Examples: 
     1986#D- 
    19701987function IGCM_sys_activ_variables { 
    19711988  IGCM_debug_PushStack "IGCM_sys_activ_variables" 
     
    19741991  fi 
    19751992 
     1993# -------------------------------------------------------------------- 
     1994#D- MPI specifications 
     1995# -------------------------------------------------------------------- 
     1996 
     1997# -------------------------------------------------------------------- 
     1998#D- Other specifications 
     1999# -------------------------------------------------------------------- 
     2000 
    19762001  ulimit -s unlimited 
    19772002 
     
    19822007# Desactivate Running Environnment Variables 
    19832008 
     2009#D-#================================================== 
     2010#D-function IGCM_sys_desactiv_variables 
     2011#D-* Purpose: unset environement variables after execution 
     2012#D-* Examples: 
     2013#D- 
    19842014function IGCM_sys_desactiv_variables { 
    19852015  IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 
     
    19872017    echo "IGCM_sys_desactiv_variables" 
    19882018  fi 
     2019# -------------------------------------------------------------------- 
     2020#D- MPI specifications 
     2021# -------------------------------------------------------------------- 
     2022 
     2023# -------------------------------------------------------------------- 
     2024#D- Other specifications 
     2025# -------------------------------------------------------------------- 
     2026 
    19892027  IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 
    19902028} 
     
    19932031# Build MPI/OMP scripts run file (dummy function) 
    19942032 
     2033#D-#================================================== 
     2034#D-function IGCM_sys_build_run_file 
     2035#D-* Purpose: build run file (deprecated) 
     2036#D-* Examples: 
     2037#D- 
    19952038function IGCM_sys_build_run_file { 
    19962039 
    1997 IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 
     2040  IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 
    19982041 
    19992042} 
     
    20012044############################################################ 
    20022045# Build MPI/OMP scripts 
     2046 
     2047#D-#================================================== 
     2048#D-function IGCM_sys_build_execution_scripts 
     2049#D-* Purpose: build execution scripts to be launch by ${HOST_MPIRUN_COMMAND} 
     2050#D-* Examples: 
     2051#D- 
    20032052function IGCM_sys_build_execution_scripts 
    20042053{ 
     
    20082057  fi 
    20092058 
    2010     # Verification with MSUB parameter 
    20112059  EXECUTION=${HOST_MPIRUN_COMMAND} 
    20122060 
     
    20222070# Then first loop on the components for the coupler ie oasis 
    20232071 
    2024 ### the coupler ie oasis must be the first one 
     2072## the coupler ie oasis must be the first one 
    20252073    for comp in ${config_ListOfComponents[*]} ; do 
    20262074 
     
    20632111  else # Only one executable. launch it. 
    20642112 
    2065     # 
    20662113    for comp in ${config_ListOfComponents[*]} ; do 
    20672114 
     
    21142161 
    21152162############################################################ 
    2116 # Check of space available on temporary filesytems 
     2163# Check of space available on temporary filesytems. 
     2164 
     2165#D-#================================================== 
     2166#D-function IGCM_sys_check_quota 
     2167#D-* Purpose: check user quota. Stop the simulation if quota above 90% 
     2168#D-* Examples: 
     2169#D- 
    21172170function IGCM_sys_check_quota { 
    21182171  IGCM_debug_PushStack "IGCM_sys_check_quota" 
     
    21332186 
    21342187    if [ "${unit_quota}" = "*" ] ; then 
    2135         IGCM_debug_Print 1 "Please, check your quota of volume on scratch" 
    2136         IGCM_debug_Print 1 "More than 100% of your quota is used" 
    2137         IGCM_debug_Print 1 "Use the ccc_quota command to check" 
    2138         IGCM_debug_Print 1 "You must have more than 10% available to run" 
    2139         IGCM_debug_Exit "Not enough space to run ! STOP HERE" 
    2140         IGCM_debug_Verif_Exit 
     2188      IGCM_debug_Print 1 "Please, check your quota of volume on scratch" 
     2189      IGCM_debug_Print 1 "More than 100% of your quota is used" 
     2190      IGCM_debug_Print 1 "Use the ccc_quota command to check" 
     2191      IGCM_debug_Print 1 "You must have more than 10% available to run" 
     2192      IGCM_debug_Exit "Not enough space to run ! STOP HERE" 
     2193      IGCM_debug_Verif_Exit 
    21412194    fi 
    21422195 
     
    21962249 
    21972250    if [ "${unit_quota}" = "*" ] ; then 
    2198         IGCM_debug_Print 1 "Please, check your quota of inode on scratch" 
    2199         IGCM_debug_Print 1 "More than 100% of your quota is used" 
    2200         IGCM_debug_Print 1 "Use the ccc_quota command to check" 
    2201         IGCM_debug_Print 1 "You must have more than 10% available to run" 
    2202         IGCM_debug_Exit "Not enough space to run ! STOP HERE" 
    2203         IGCM_debug_Verif_Exit 
     2251      IGCM_debug_Print 1 "Please, check your quota of inode on scratch" 
     2252      IGCM_debug_Print 1 "More than 100% of your quota is used" 
     2253      IGCM_debug_Print 1 "Use the ccc_quota command to check" 
     2254      IGCM_debug_Print 1 "You must have more than 10% available to run" 
     2255      IGCM_debug_Exit "Not enough space to run ! STOP HERE" 
     2256      IGCM_debug_Verif_Exit 
    22042257    fi 
    22052258 
     
    22552308#D-* Examples: IGCM_sys_CountJobInQueue ${JobName} NbRun 
    22562309#D- 
    2257  
    22582310function IGCM_sys_CountJobInQueue { 
    22592311  IGCM_debug_PushStack "IGCM_sys_CountJobInQueue" 
     
    22752327# NCO OPERATOR 
    22762328 
     2329#D-#================================================== 
     2330#D-function IGCM_sys_ncap2 
     2331#D-* Purpose: encapsulate ncap2 call so as to manage error code and retry 
     2332#D-* Examples: 
     2333#D- 
    22772334function IGCM_sys_ncap2 { 
    22782335  IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 
     
    23052362 
    23062363  if [ ${status} -gt 0 ] ; then 
    2307       echo "IGCM_sys_ncap2 : ncap2 error" 
    2308       IGCM_debug_Exit "ncap2" 
     2364    echo "IGCM_sys_ncap2 : ncap2 error" 
     2365    IGCM_debug_Exit "ncap2" 
    23092366  fi 
    23102367 
     
    23122369} 
    23132370 
     2371#D-#================================================== 
     2372#D-function IGCM_sys_ncatted 
     2373#D-* Purpose: encapsulate ncatted call so as to manage error code and retry 
     2374#D-* Examples: 
     2375#D- 
    23142376function IGCM_sys_ncatted { 
    23152377  IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 
     
    23422404 
    23432405  if [ ${status} -gt 0 ] ; then 
    2344       echo "IGCM_sys_ncatted : ncatted error" 
    2345       IGCM_debug_Exit "ncatted" 
     2406    echo "IGCM_sys_ncatted : ncatted error" 
     2407    IGCM_debug_Exit "ncatted" 
    23462408  fi 
    23472409 
     
    23492411} 
    23502412 
     2413#D-#================================================== 
     2414#D-function IGCM_sys_ncbo 
     2415#D-* Purpose: encapsulate ncbo call so as to manage error code and retry 
     2416#D-* Examples: 
     2417#D- 
    23512418function IGCM_sys_ncbo { 
    23522419  IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 
     
    23792446 
    23802447  if [ ${status} -gt 0 ] ; then 
    2381       echo "IGCM_sys_ncbo : ncbo error" 
    2382       IGCM_debug_Exit "ncbo" 
     2448    echo "IGCM_sys_ncbo : ncbo error" 
     2449    IGCM_debug_Exit "ncbo" 
    23832450  fi 
    23842451 
     
    23862453} 
    23872454 
     2455#D-#================================================== 
     2456#D-function IGCM_sys_ncdif 
     2457#D-* Purpose: encapsulate ncdiff call so as to manage error code and retry 
     2458#D-* Examples: 
     2459#D- 
    23882460function IGCM_sys_ncdiff { 
    23892461  IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 
     
    24162488 
    24172489  if [ ${status} -gt 0 ] ; then 
    2418       echo "IGCM_sys_ncdiff : ncdiff error" 
    2419       IGCM_debug_Exit "ncdiff" 
     2490    echo "IGCM_sys_ncdiff : ncdiff error" 
     2491    IGCM_debug_Exit "ncdiff" 
    24202492  fi 
    24212493 
     
    24232495} 
    24242496 
     2497#D-#================================================== 
     2498#D-function IGCM_sys_ncea 
     2499#D-* Purpose: encapsulate ncea call so as to manage error code and retry 
     2500#D-* Examples: 
     2501#D- 
    24252502function IGCM_sys_ncea { 
    24262503  IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 
     
    24532530 
    24542531  if [ ${status} -gt 0 ] ; then 
    2455       echo "IGCM_sys_ncea : ncea error" 
    2456       IGCM_debug_Exit "ncea" 
     2532    echo "IGCM_sys_ncea : ncea error" 
     2533    IGCM_debug_Exit "ncea" 
    24572534  fi 
    24582535 
     
    24602537} 
    24612538 
     2539#D-#================================================== 
     2540#D-function IGCM_sys_ncecat 
     2541#D-* Purpose: encapsulate ncecat call so as to manage error code and retry 
     2542#D-* Examples: 
     2543#D- 
    24622544function IGCM_sys_ncecat { 
    24632545  IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 
     
    24902572 
    24912573  if [ ${status} -gt 0 ] ; then 
    2492       echo "IGCM_sys_ncecat : ncecat error" 
    2493       IGCM_debug_Exit "ncecat" 
     2574    echo "IGCM_sys_ncecat : ncecat error" 
     2575    IGCM_debug_Exit "ncecat" 
    24942576  fi 
    24952577 
     
    24972579} 
    24982580 
     2581#D-#================================================== 
     2582#D-function IGCM_sys_ncflint 
     2583#D-* Purpose: encapsulate ncflint call so as to manage error code and retry 
     2584#D-* Examples: 
     2585#D- 
    24992586function IGCM_sys_ncflint { 
    25002587  IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 
     
    25272614 
    25282615  if [ ${status} -gt 0 ] ; then 
    2529       echo "IGCM_sys_ncflint : ncflint error" 
    2530       IGCM_debug_Exit "ncflint" 
     2616    echo "IGCM_sys_ncflint : ncflint error" 
     2617    IGCM_debug_Exit "ncflint" 
    25312618  fi 
    25322619 
     
    25342621} 
    25352622 
     2623#D-#================================================== 
     2624#D-function IGCM_sys_ncks 
     2625#D-* Purpose: encapsulate ncks call so as to manage error code and retry 
     2626#D-* Examples: 
     2627#D- 
    25362628function IGCM_sys_ncks { 
    25372629  IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 
     
    25642656 
    25652657  if [ ${status} -gt 0 ] ; then 
    2566       echo "IGCM_sys_ncks : ncks error" 
    2567       IGCM_debug_Exit "ncks" 
     2658    echo "IGCM_sys_ncks : ncks error" 
     2659    IGCM_debug_Exit "ncks" 
    25682660  fi 
    25692661 
     
    25712663} 
    25722664 
     2665#D-#================================================== 
     2666#D-function IGCM_sys_ncpdq 
     2667#D-* Purpose: encapsulate ncpdq call so as to manage error code and retry 
     2668#D-* Examples: 
     2669#D- 
    25732670function IGCM_sys_ncpdq { 
    25742671  IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 
     
    26012698 
    26022699  if [ ${status} -gt 0 ] ; then 
    2603       echo "IGCM_sys_ncpdq : ncpdq error" 
    2604       IGCM_debug_Exit "ncpdq" 
     2700    echo "IGCM_sys_ncpdq : ncpdq error" 
     2701    IGCM_debug_Exit "ncpdq" 
    26052702  fi 
    26062703 
     
    26082705} 
    26092706 
     2707#D-#================================================== 
     2708#D-function IGCM_sys_ncra 
     2709#D-* Purpose: encapsulate ncra call so as to manage error code and retry 
     2710#D-* Examples: 
     2711#D- 
    26102712function IGCM_sys_ncra { 
    26112713  IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 
     
    26382740 
    26392741  if [ ${status} -gt 0 ] ; then 
    2640       echo "IGCM_sys_ncra : ncra error" 
    2641       IGCM_debug_Exit "ncra" 
     2742    echo "IGCM_sys_ncra : ncra error" 
     2743    IGCM_debug_Exit "ncra" 
    26422744  fi 
    26432745 
     
    26452747} 
    26462748 
     2749#D-#================================================== 
     2750#D-function IGCM_sys_ncrcat 
     2751#D-* Purpose: encapsulate ncrcat call so as to manage error code and retry 
     2752#D-* Examples: 
     2753#D- 
    26472754function IGCM_sys_ncrcat { 
    26482755  IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 
     
    26852792 
    26862793  if [ ${status} -gt 0 ] ; then 
    2687       echo "IGCM_sys_ncrcat : ncrcat error" 
    2688       #IGCM_debug_Exit "ncrcat" 
     2794    echo "IGCM_sys_ncrcat : ncrcat error" 
     2795    #IGCM_debug_Exit "ncrcat" 
    26892796  fi 
    26902797 
     
    26922799} 
    26932800 
     2801#D-#================================================== 
     2802#D-function IGCM_sys_ncrename 
     2803#D-* Purpose: encapsulate ncrename call so as to manage error code and retry 
     2804#D-* Examples: 
     2805#D- 
    26942806function IGCM_sys_ncrename { 
    26952807  IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 
     
    27222834 
    27232835  if [ ${status} -gt 0 ] ; then 
    2724       echo "IGCM_sys_ncrename : ncrename error" 
    2725       IGCM_debug_Exit "ncrename" 
     2836    echo "IGCM_sys_ncrename : ncrename error" 
     2837    IGCM_debug_Exit "ncrename" 
    27262838  fi 
    27272839 
     
    27292841} 
    27302842 
     2843#D-#================================================== 
     2844#D-function IGCM_sys_ncwa 
     2845#D-* Purpose: encapsulate ncwa call so as to manage error code and retry 
     2846#D-* Examples: 
     2847#D- 
    27312848function IGCM_sys_ncwa { 
    27322849  IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 
     
    27592876 
    27602877  if [ ${status} -gt 0 ] ; then 
    2761       echo "IGCM_sys_ncwa : ncwa error" 
    2762       IGCM_debug_Exit "ncwa" 
     2878    echo "IGCM_sys_ncwa : ncwa error" 
     2879    IGCM_debug_Exit "ncwa" 
    27632880  fi 
    27642881 
     
    27692886# CDO OPERATOR 
    27702887 
     2888#D-#================================================== 
     2889#D-function IGCM_sys_cdo 
     2890#D-* Purpose: encapsulate cdo call so as to manage error code and retry 
     2891#D-* Examples: 
     2892#D- 
    27712893function IGCM_sys_cdo { 
    27722894  IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_default.ksh

    r809 r811  
    115115 
    116116#==================================================== 
    117 #- ARCHIVE (dedicated to large files) 
    118 typeset -r ARCHIVE=/home/${LOGIN} 
     117#- ARCHIVE 
     118typeset ARCHIVE=${ARCHIVE:=/home/${LOGIN}} 
    119119 
    120120#==================================================== 
    121121#- STORAGE (dedicated to small/medium files) 
    122 typeset -r STORAGE=${ARCHIVE} 
     122typeset STORAGE=${ARCHIVE} 
    123123 
    124124#==================================================== 
     
    165165#D- 
    166166function IGCM_sys_ChangeArchive { 
    167  
    168167  IGCM_debug_Print 1 " dummy function : IGCM_sys_ChangeArchive " 
    169  
    170168} 
    171169 
     
    201199    ${@} 
    202200EOF 
    203   if [ $? -gt 0 ] ; then 
    204     echo "IGCM_sys_RshArchive : erreur." 
     201  status=$? 
     202  if [ ${status} -gt 0 ] ; then 
     203    IGCM_debug_Print 2 "IGCM_sys_RshArchive : command failed error code ${status}" 
    205204    IGCM_debug_Exit "IGCM_sys_RshArchive" 
    206205  fi 
     
    219218  fi 
    220219 
    221   #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL 
    222   #cat tmp_IGCM_sys_RshPost_$$ 
    223220  # keep standard input (stdin) for the loop onto temporary file 
    224221  cat >tmp_IGCM_sys_RshPost_$$ 
     
    231228  # delete temporary file 
    232229  \rm tmp_IGCM_sys_RshPost_$$ 
    233  
    234230  IGCM_debug_PopStack "IGCM_sys_RshPost" 
    235231} 
     
    270266  fi 
    271267 
     268  sleep 10 
     269  rm -f job_end.mail 
     270 
    272271  if [ $? -gt 0 ] ; then 
    273272    echo "IGCM_sys_SendMail : erreur." 
     
    313312  fi 
    314313  #- creation de repertoire sur le serveur fichier 
    315   if [ ! -d ${1} ]; then 
    316     \mkdir -p $1 
    317     if [ $? -gt 0 ] ; then 
    318       echo "IGCM_sys_MkdirArchive : erreur." 
    319       IGCM_debug_Exit "IGCM_sys_MkdirArchive" 
    320     fi 
     314  mkdir -p $1 
     315  status=$? 
     316 
     317  if [ ${status} -gt 0 ] ; then 
     318    IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}" 
     319    IGCM_debug_Exit "IGCM_sys_MkdirArchive" 
    321320  fi 
    322321  IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 
     
    428427  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 
    429428  IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 
    430  
    431429  return ${ExistFlag} 
    432430} 
     
    712710 
    713711#D-#================================================== 
     712#D-function IGCM_sys_Miror_libIGCM 
     713#D-* Purpose: Mirror libIGCM PATH and lib to frontend 
     714#D-* Examples: 
     715#D- 
     716function IGCM_sys_Mirror_libIGCM { 
     717  IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" 
     718  if ( $DEBUG_sys ) ; then 
     719    echo "IGCM_sys_Mirror_libIGCM" 
     720  fi 
     721 
     722  typeset status 
     723 
     724  mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} 
     725 
     726  echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 
     727  ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 
     728  status=$? 
     729 
     730  if [ ${status} -gt 0 ] ; then 
     731    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend." 
     732    cat out_rsync 
     733  fi 
     734  IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" 
     735} 
     736 
     737#D-#================================================== 
    714738#D-function IGCM_sys_Cp 
    715739#D-* Purpose: generic cp 
     
    841865 
    842866    if [ ${status} -gt 0 ] ; then 
    843       echo "IGCM_sys_Put_Dir : error code ${status}" 
     867      IGCM_debug_Print 2 "IGCM_sys_Put_Dir : cp failed error code ${status}" 
    844868      cat out_rsync 
    845869      IGCM_debug_Exit "IGCM_sys_Put_Dir" 
     
    870894    fi 
    871895 
    872     typeset RET 
     896    typeset status 
    873897 
    874898    #USUAL WAY 
    875     \cp -R $1 $2 > out_rsync 2>&1 
    876     RET=$? 
    877  
    878     if [ ${RET} -gt 0 ] ; then 
    879       echo "IGCM_sys_Get_Dir : error." 
     899    \cp -ur $1 $2 > out_rsync 2>&1 
     900    status=$? 
     901 
     902    if [ ${status} -gt 0 ] ; then 
     903      IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status}" 
    880904      cat out_rsync 
    881905      IGCM_debug_Exit "IGCM_sys_Get_Dir" 
     
    906930    fi 
    907931 
    908     typeset RET 
    909  
    910     #USUAL WAY 
    911     cp -RL $1 $2 > out_rsync 2>&1 
    912     RET=$? 
    913  
    914     if [ ${RET} -gt 0 ] ; then 
     932    typeset NB_ESSAI DELAI status i 
     933    # number of tentative 
     934    NB_ESSAI=3 
     935    # time delay between tentative 
     936    DELAI=2 
     937 
     938    i=0 
     939    while [ $i -lt $NB_ESSAI ] ; do 
     940      \cp -urL $1 $2 > out_rsync 2>&1 
     941      status=$? 
     942      if [ ${status} -gt 0 ]; then 
     943        IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     944        IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." 
     945        sleep $DELAI 
     946      else 
     947        break 
     948      fi 
     949      (( i = i + 1 )) 
     950    done 
     951 
     952    if [ ${status} -gt 0 ] ; then 
    915953      echo "IGCM_sys_Get_Master : error." 
    916954      cat out_rsync 
     
    924962  IGCM_debug_PopStack "IGCM_sys_Get_Master" 
    925963} 
     964 
     965#==================================================== 
     966#- Call IGCM_sys_Mirror_libIGCM now ! 
     967if ( $MirrorlibIGCM ) ; then 
     968  IGCM_sys_Mirror_libIGCM 
     969fi 
    926970 
    927971#D-#================================================== 
     
    947991      IGCM_sys_Chmod 444 ${1} 
    948992    fi 
     993    # 
     994    # Only if we use rsync 
     995    #IGCM_sys_MkdirArchive $( dirname $2 ) 
     996    # 
     997    #USUAL WAY 
     998    \cp $1 $2 > out_rsync 2>&1 
     999    status=$? 
     1000 
     1001#       #RSYNC WITH NETWORK SSH CALL 
     1002#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     1003#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     1004 
     1005#       #RSYNC WITH NFS USE 
     1006#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     1007#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     1008 
     1009#       status=$? 
     1010#       IGCM_sys_Rsync_out $status 
     1011 
     1012#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1013#       (( status=status+$? )) 
     1014 
     1015    if [ ${status} -gt 0 ] ; then 
     1016      echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 
     1017      cat out_rsync 
     1018      IGCM_debug_Exit "IGCM_sys_Put_Rest" 
     1019    else 
     1020      \rm out_rsync 
     1021    fi 
     1022  else 
     1023    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1024  fi 
     1025  IGCM_debug_PopStack "IGCM_sys_Put_Rest" 
     1026} 
     1027 
     1028#D-#================================================== 
     1029#D-function IGCM_sys_PutBuffer_Rest 
     1030#D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 
     1031#D-           File and target directory must exist. 
     1032#D-* Examples: 
     1033#D- 
     1034function IGCM_sys_PutBuffer_Rest { 
     1035  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 
     1036  if ( $DEBUG_sys ) ; then 
     1037    echo "IGCM_sys_PutBuffer_Rest :" $@ 
     1038  fi 
     1039  if [ $DRYRUN = 0 ]; then 
     1040    if [ ! -f ${1} ] ; then 
     1041      echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 
     1042      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     1043    fi 
     1044 
     1045    typeset status 
     1046    # 
     1047    if [ X${JobType} = XRUN ] ; then 
     1048      IGCM_sys_Chmod 444 ${1} 
     1049    fi 
    9491050 
    9501051    # 
     
    9531054    status=$? 
    9541055 
    955 #       #RSYNC WITH NETWORK SSH CALL 
    956 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
    957 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
    958  
    959 #       #RSYNC WITH NFS USE 
    960 #       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
    961 #       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    962  
    963 #       status=$? 
    964 #       IGCM_sys_Rsync_out $status 
    965  
    966 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    967 #       (( status=status+$? )) 
    968  
    969     if [ ${status} -gt 0 ] ; then 
    970       echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 
    971       cat out_rsync 
    972       IGCM_debug_Exit "IGCM_sys_Put_Rest" 
    973     else 
    974       \rm out_rsync 
    975     fi 
    976   else 
    977     ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    978   fi 
    979   IGCM_debug_PopStack "IGCM_sys_Put_Rest" 
    980 } 
    981  
    982 #D-#================================================== 
    983 #D-function IGCM_sys_PutBuffer_Rest 
    984 #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 
    985 #D-           File and target directory must exist. 
    986 #D-* Examples: 
    987 #D- 
    988 function IGCM_sys_PutBuffer_Rest { 
    989   IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 
    990   if ( $DEBUG_sys ) ; then 
    991     echo "IGCM_sys_PutBuffer_Rest :" $@ 
    992   fi 
    993   if [ $DRYRUN = 0 ]; then 
    994     if [ ! -f ${1} ] ; then 
    995       echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 
    996       IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
    997     fi 
    998  
    999     typeset status 
    1000     # 
    1001     if [ X${JobType} = XRUN ] ; then 
    1002       IGCM_sys_Chmod 444 ${1} 
    1003     fi 
    1004  
    1005     # 
    1006     # USUAL WAY 
    1007     \cp $1 $2 > out_rsync 2>&1 
    1008     status=$? 
    1009  
    10101056    if [ ${status} -gt 0 ] ; then 
    10111057      echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 
     1058      [ -f ${2} ] && ls -l ${2} 
     1059      [ -f ${2}/${1} ] && ls -l ${2}/${1} 
    10121060      cat out_rsync 
    10131061      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     
    10421090    echo "IGCM_sys_Put_Out :" $@ 
    10431091  fi 
     1092 
     1093  typeset status 
     1094 
    10441095  if [ $DRYRUN = 0 ]; then 
    1045     if [ -f ${1} ] ; then 
    1046       if [ ! -d $( dirname $2 ) ] ; then 
    1047         IGCM_sys_MkdirArchive $( dirname $2 ) 
    1048       fi 
    1049     else 
     1096    if [ ! -f ${1} ] ; then 
    10501097      echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 
    10511098      IGCM_debug_PopStack "IGCM_sys_Put_Out" 
    10521099      return 1 
    10531100    fi 
    1054  
    1055     typeset RET 
     1101    # 
     1102    IGCM_sys_MkdirArchive $( dirname $2 ) 
    10561103    # 
    10571104    if [ X${JobType} = XRUN ] ; then 
     
    10641111    echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 
    10651112    ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 
    1066     RET=$? 
    1067     IGCM_sys_Rsync_out $RET 
     1113    status=$? 
     1114    IGCM_sys_Rsync_out $status 
    10681115 
    10691116    ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1070     (( RET=RET+$? )) 
    1071  
    1072     if [ ${RET} -gt 0 ] ; then 
    1073       echo "IGCM_sys_Put_Out : error." 
     1117    (( status=status+$? )) 
     1118 
     1119    if [ ${status} -gt 0 ] ; then 
     1120      IGCM_debug_Print 2 "IGCM_sys_Put_Out : rsync failed error code ${status}" 
    10741121      cat out_rsync 
    10751122      IGCM_debug_Exit "IGCM_sys_Put_Out" 
     
    10941141    echo "IGCM_sys_PutBuffer_Out :" $@ 
    10951142  fi 
     1143 
     1144  typeset NB_ESSAI DELAI status i exist skip 
     1145 
     1146  # number of tentative 
     1147  NB_ESSAI=3 
     1148  # time delay between tentative 
     1149  DELAI=2 
     1150 
    10961151  if [ $DRYRUN = 0 ]; then 
    10971152    if [ ! -f ${1} ] ; then 
     
    11031158    IGCM_sys_Mkdir $( dirname $2 ) 
    11041159    # 
    1105     typeset RET 
    1106  
    1107     if [ X${JobType} = XRUN ] ; then 
    1108       if [ X${3} = X ] ; then 
    1109         IGCM_sys_Chmod 444 ${1} 
     1160 
     1161    exist=false 
     1162    skip=false 
     1163    if [ -f $2 ] ; then 
     1164      IGCM_debug_Print 1 "$2 already exist" 
     1165      exist=true 
     1166      if [ "X$( diff $1 $2 )" = X ] ; then 
     1167        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 
     1168        status=0 
     1169        skip=true 
     1170      else 
     1171        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 
     1172        skip=false 
    11101173      fi 
    11111174    fi 
    11121175    # 
    1113     # USUAL WAY 
    1114     \cp $1 $2 > out_rsync 2>&1 
    1115     RET=$? 
    1116  
    1117     if [ ${RET} -gt 0 ] ; then 
     1176    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 
     1177      IGCM_sys_Chmod u+w $2 
     1178    fi 
     1179 
     1180    if [ X${skip} = Xfalse ] ; then 
     1181      i=0 
     1182      while [ $i -lt $NB_ESSAI ] ; do 
     1183        # USUAL WAY 
     1184        \cp $1 $2 > out_rsync 2>&1 
     1185        status=$? 
     1186        if [ ${status} -gt 0 ]; then 
     1187          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1188          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again." 
     1189          [ -f ${2} ] && ls -l ${2} 
     1190          [ -f ${2}/${1} ] && ls -l ${2}/${1} 
     1191          sleep $DELAI 
     1192        else 
     1193          break 
     1194        fi 
     1195        (( i = i + 1 )) 
     1196      done 
     1197    fi 
     1198 
     1199    if [ ${status} -gt 0 ] ; then 
    11181200      echo "IGCM_sys_PutBuffer_Out : error." 
     1201      [ -f ${2} ] && ls -l ${2} 
     1202      [ -f ${2}/${1} ] && ls -l ${2}/${1} 
    11191203      cat out_rsync 
    11201204      IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 
    11211205    else 
     1206 
     1207      if [ X${JobType} = XRUN ] ; then 
     1208        if [ X${3} = X ] ; then 
     1209          [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} 
     1210          [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} 
     1211        fi 
     1212      fi 
     1213 
    11221214      \rm out_rsync 
    11231215    fi 
     
    11371229  IGCM_debug_PushStack "IGCM_sys_Get" $@ 
    11381230 
    1139   typeset DEST RET dm_liste ifile target 
     1231  typeset DEST status dm_liste 
    11401232 
    11411233  if ( $DEBUG_sys ) ; then 
     
    11531245    # test if the (first) file is present in the old computation : 
    11541246    IGCM_sys_TestFileArchive ${dm_liste[0]} 
    1155     RET=$? 
    1156     if [ ${RET} -gt 0 ] ; then 
     1247    status=$? 
     1248    if [ ${status} -gt 0 ] ; then 
    11571249      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 
    11581250      IGCM_debug_Exit "IGCM_sys_Get" 
    1159             #return 
    1160     fi 
    1161  
    1162     (( RET=0 )) 
    1163     for target in ${dm_liste[*]} ; do 
    1164       \cp ${target} ${DEST} >> out_rsync 2>&1 
    1165       (( RET=RET+$? )) 
    1166     done 
    1167  
    1168 #       echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1 
    1169 #       ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1 
    1170 #       RET=$? 
    1171 #       IGCM_sys_Rsync_out $RET 
    1172  
    1173 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1174 #       (( RET=RET+$? )) 
    1175  
    1176     if [ ${RET} -gt 0 ] ; then 
    1177       echo "IGCM_sys_Get : error" 
     1251      return 
     1252    fi 
     1253 
     1254    #USUAL WAY 
     1255    \cp ${dm_liste[*]} ${DEST} > out_rsync 2>&1 
     1256    status=$? 
     1257 
     1258    if [ ${status} -gt 0 ] ; then 
     1259      IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status}" 
    11781260      cat out_rsync 
    1179       \rm out_rsync 
    11801261      IGCM_debug_Exit "IGCM_sys_Get" 
    11811262    else 
     
    11961277  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
    11971278 
    1198   typeset DEST RET status buf_liste ifile target file_work 
     1279  typeset DEST buf_liste target file_work 
     1280  typeset NB_ESSAI DELAI status i 
    11991281 
    12001282  if ( $DEBUG_sys ) ; then 
    12011283    echo "IGCM_sys_GetBuffer :" $@ 
    12021284  fi 
     1285 
     1286  # number of tentative 
     1287  NB_ESSAI=3 
     1288  # time delay between tentative 
     1289  DELAI=2 
     1290 
    12031291  if [ $DRYRUN -le 2 ]; then 
    12041292    if [ X${1} = X'/l' ] ; then 
     
    12121300    #USUAL WAY 
    12131301    if [ X${1} = X'/l' ] ; then 
    1214       (( RET=0 )) 
    12151302      for target in ${buf_liste[*]} ; do 
    12161303        local_file=$( basename ${target} ) 
    1217         \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1218         (( RET = RET + $? )) 
     1304        i=0 
     1305        while [ $i -lt $NB_ESSAI ] ; do 
     1306          \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1307          status=$? 
     1308          if [ ${status} -gt 0 ]; then 
     1309            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1310            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." 
     1311            sleep $DELAI 
     1312          else 
     1313            break 
     1314          fi 
     1315          (( i = i + 1 )) 
     1316        done 
     1317        if [ ${status} -gt 0 ] ; then 
     1318          echo "IGCM_sys_Get : error" 
     1319          cat out_rsync 
     1320          \rm out_rsync 
     1321          IGCM_debug_Exit "IGCM_sys_GetBuffer" 
     1322        else 
     1323          \rm out_rsync 
     1324        fi 
    12191325      done 
    12201326    else 
    1221       \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
    1222       status=$? 
    1223     fi 
    1224  
    1225     if [ ${RET} -gt 0 ] ; then 
    1226       echo "IGCM_sys_GetBuffer : error" 
    1227       cat out_rsync 
    1228       \rm out_rsync 
    1229       IGCM_debug_Exit "IGCM_sys_GetBuffer" 
    1230     else 
    1231       \rm out_rsync 
     1327      i=0 
     1328      while [ $i -lt $NB_ESSAI ] ; do 
     1329        \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
     1330        status=$? 
     1331        if [ ${status} -gt 0 ]; then 
     1332          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1333          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." 
     1334          sleep $DELAI 
     1335        else 
     1336          break 
     1337        fi 
     1338        (( i = i + 1 )) 
     1339      done 
     1340      if [ ${status} -gt 0 ] ; then 
     1341        echo "IGCM_sys_Get : error" 
     1342        cat out_rsync 
     1343        \rm out_rsync 
     1344        IGCM_debug_Exit "IGCM_sys_GetBuffer" 
     1345      else 
     1346        \rm out_rsync 
     1347      fi 
    12321348    fi 
    12331349  else 
     
    12861402#D-#================================================== 
    12871403#D-function IGCM_sys_Dods_Cp 
    1288 #D-* Purpose: Copy from $(ARCHIVE) files to /tmp/DODS for simulation of internet protocole. 
     1404#D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole. 
    12891405#D-* Examples: 
    12901406#D- 
     
    12981414#D-#================================================== 
    12991415#D-function IGCM_sys_Put_Dods 
    1300 #D-* Purpose: Put $(ARCHIVE) files on /tmp/DODS for simulation of internet protocole. 
     1416#D-* Purpose: Put ${ARCHIVE} files on DODS internet protocole. Dummy function here 
    13011417#D-* Examples: 
    13021418#D- 
     
    13061422    echo "IGCM_sys_Put_Dods :" $@ 
    13071423  fi 
    1308   if [ $DRYRUN = 0 ]; then 
    1309     RET=0 
    1310  
    1311     if [ ${RET} -gt 0 ] ; then 
    1312       echo "IGCM_sys_Put_Dods : error." 
    1313       IGCM_debug_Exit "IGCM_sys_Put_Dods" 
    1314     fi 
    1315   else 
    1316     ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    1317   fi 
    13181424  IGCM_debug_PopStack "IGCM_sys_Put_Dods" 
    13191425} 
     
    13221428# REBUILD OPERATOR 
    13231429 
     1430#D-#================================================== 
     1431#D-function IGCM_sys_rebuild 
     1432#D-* Purpose: rebuild parallel files 
     1433#D-* Examples: 
     1434#D- 
    13241435function IGCM_sys_rebuild { 
    13251436  IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 
     
    13271438    echo "IGCM_sys_rebuild :" $@ 
    13281439  fi 
    1329   rebuild -f -o $@ 
    1330   if [ $? -gt 0 ] ; then 
    1331     echo "IGCM_sys_rebuild : rebuild error" 
     1440 
     1441  typeset NB_ESSAI DELAI status i firstArg 
     1442  # number of tentative 
     1443  NB_ESSAI=3 
     1444  # time delay between tentative 
     1445  DELAI=2 
     1446 
     1447  i=0 
     1448  while [ $i -lt $NB_ESSAI ] ; do 
     1449    rebuild -f -o $@ > out_rsync 2>&1 
     1450    status=$? 
     1451    if [ ${status} -gt 0 ] ; then 
     1452      IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 
     1453      cat out_rsync 
     1454      \rm out_rsync 
     1455      IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
     1456      firstArg=${1} 
     1457      \rm ${firstArg} 
     1458      sleep $DELAI 
     1459    else 
     1460      \rm out_rsync 
     1461      break 
     1462    fi 
     1463    (( i = i + 1 )) 
     1464  done 
     1465 
     1466  if [ ${status} -gt 0 ] ; then 
     1467    echo "IGCM_sys_rebuild : rebuild error code is ${status}" 
    13321468    IGCM_debug_Exit "rebuild" 
    13331469  fi 
     
    13361472} 
    13371473 
     1474#D-#================================================== 
     1475#D-function IGCM_sys_rebuild_station 
     1476#D-* Purpose: rebuild parallel files describing station  
     1477#D-* Examples: 
     1478#D- 
    13381479function IGCM_sys_rebuild_station { 
    13391480  IGCM_debug_PushStack "IGCM_sys_rebuild_station" -- $@ 
     
    14301571# Activate Running Environnment Variables 
    14311572 
     1573#D-#================================================== 
     1574#D-function IGCM_sys_desactiv_variables 
     1575#D-* Purpose: set environement variables prior to execution 
     1576#D-* Examples: 
     1577#D- 
    14321578function IGCM_sys_activ_variables { 
    14331579  IGCM_debug_PushStack "IGCM_sys_activ_variables" 
     
    14351581    echo "IGCM_sys_activ_variables" 
    14361582  fi 
     1583 
     1584# -------------------------------------------------------------------- 
     1585#D- MPI specifications 
     1586# -------------------------------------------------------------------- 
     1587 
     1588# -------------------------------------------------------------------- 
     1589#D- Other specifications 
     1590# -------------------------------------------------------------------- 
     1591 
    14371592  IGCM_debug_PopStack "IGCM_sys_activ_variables" 
    14381593} 
     
    14411596# Desactivate Running Environnment Variables 
    14421597 
     1598#D-#================================================== 
     1599#D-function IGCM_sys_desactiv_variables 
     1600#D-* Purpose: unset environement variables after execution 
     1601#D-* Examples: 
     1602#D- 
    14431603function IGCM_sys_desactiv_variables { 
    14441604  IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 
     
    14461606    echo "IGCM_sys_desactiv_variables" 
    14471607  fi 
     1608# -------------------------------------------------------------------- 
     1609#D- MPI specifications 
     1610# -------------------------------------------------------------------- 
     1611 
     1612# -------------------------------------------------------------------- 
     1613#D- Other specifications 
     1614# -------------------------------------------------------------------- 
     1615 
    14481616  IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 
    14491617} 
     
    14521620# Build MPI/OMP scripts run file (dummy function) 
    14531621 
     1622#D-#================================================== 
     1623#D-function IGCM_sys_build_run_file 
     1624#D-* Purpose: build run file (deprecated) 
     1625#D-* Examples: 
     1626#D- 
    14541627function IGCM_sys_build_run_file { 
    14551628 
     
    14601633############################################################ 
    14611634# Build MPI/OMP scripts 
     1635 
     1636#D-#================================================== 
     1637#D-function IGCM_sys_build_execution_scripts 
     1638#D-* Purpose: build execution scripts to be launch by ${HOST_MPIRUN_COMMAND} 
     1639#D-* Examples: 
     1640#D- 
    14621641function IGCM_sys_build_execution_scripts 
    14631642{ 
     
    14711650 
    14721651  if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ]  ; then 
    1473     IGCM_debug_Exit "IGCM_sys_titane build_execution_scripts : Job_${config_UserChoices_JobName} doesn't exist in SUBMIT_DIR : ${SUBMIT_DIR} " 
     1652    IGCM_debug_Exit "IGCM_sys_default build_execution_scripts : Job_${config_UserChoices_JobName} don't exist in SUBMIT_DIR : ${SUBMIT_DIR} " 
    14741653  fi 
    14751654 
     
    17121891  fi 
    17131892 
    1714   IGCM_debug_Print 1 "sys $( hostname ) : La commande d execution est " 
    1715   IGCM_debug_Print 1 $EXECUTION 
     1893  IGCM_debug_Print 1 "sys $( hostname ) : execution command is" 
     1894  IGCM_debug_Print 1 "$EXECUTION" 
    17161895 
    17171896  IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" 
     
    17191898 
    17201899############################################################ 
    1721 # Check of space available on temporary filesytems 
     1900# Check of space available on temporary filesytems. Dummy function here 
     1901 
     1902#D-#================================================== 
     1903#D-function IGCM_sys_check_quota. Dummy call here 
     1904#D-* Purpose: check user quota. Stop the simulation if quota above 90% 
     1905#D-* Examples: 
     1906#D- 
    17221907function IGCM_sys_check_quota { 
    17231908  IGCM_debug_PushStack "IGCM_sys_check_quota" 
     
    17281913} 
    17291914 
     1915#D-#================================================== 
     1916#D-function IGCM_sys_CountJobInQueue 
     1917#D-* Purpose: Check if job_name is currently 
     1918#D-  running or in queue 
     1919#D-* Examples: IGCM_sys_CountJobInQueue ${JobName} NbRun 
     1920#D- 
     1921function IGCM_sys_CountJobInQueue { 
     1922  IGCM_debug_PushStack "IGCM_sys_CountJobInQueue" 
     1923  if ( $DEBUG_sys ) ; then 
     1924    echo "IGCM_sys_CountJobInQueue" 
     1925  fi 
     1926  IGCM_debug_PopStack "IGCM_sys_CountJobInQueue" 
     1927} 
     1928 
    17301929############################################################## 
    17311930# NCO OPERATOR 
    17321931 
     1932#D-#================================================== 
     1933#D-function IGCM_sys_ncap2 
     1934#D-* Purpose: encapsulate ncap2 call so as to manage error code and retry 
     1935#D-* Examples: 
     1936#D- 
    17331937function IGCM_sys_ncap2 { 
    17341938  IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 
     
    17611965 
    17621966  if [ ${status} -gt 0 ] ; then 
    1763       echo "IGCM_sys_ncap2 : ncap2 error" 
    1764       IGCM_debug_Exit "ncap2" 
     1967    echo "IGCM_sys_ncap2 : ncap2 error" 
     1968    IGCM_debug_Exit "ncap2" 
    17651969  fi 
    17661970 
     
    17681972} 
    17691973 
     1974#D-#================================================== 
     1975#D-function IGCM_sys_ncatted 
     1976#D-* Purpose: encapsulate ncatted call so as to manage error code and retry 
     1977#D-* Examples: 
     1978#D- 
    17701979function IGCM_sys_ncatted { 
    17711980  IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 
     
    17982007 
    17992008  if [ ${status} -gt 0 ] ; then 
    1800       echo "IGCM_sys_ncatted : ncatted error" 
    1801       IGCM_debug_Exit "ncatted" 
     2009    echo "IGCM_sys_ncatted : ncatted error" 
     2010    IGCM_debug_Exit "ncatted" 
    18022011  fi 
    18032012 
     
    18052014} 
    18062015 
     2016#D-#================================================== 
     2017#D-function IGCM_sys_ncbo 
     2018#D-* Purpose: encapsulate ncbo call so as to manage error code and retry 
     2019#D-* Examples: 
     2020#D- 
    18072021function IGCM_sys_ncbo { 
    18082022  IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 
     
    18352049 
    18362050  if [ ${status} -gt 0 ] ; then 
    1837       echo "IGCM_sys_ncbo : ncbo error" 
    1838       IGCM_debug_Exit "ncbo" 
     2051    echo "IGCM_sys_ncbo : ncbo error" 
     2052    IGCM_debug_Exit "ncbo" 
    18392053  fi 
    18402054 
     
    18422056} 
    18432057 
     2058#D-#================================================== 
     2059#D-function IGCM_sys_ncdif 
     2060#D-* Purpose: encapsulate ncdiff call so as to manage error code and retry 
     2061#D-* Examples: 
     2062#D- 
    18442063function IGCM_sys_ncdiff { 
    18452064  IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 
     
    18722091 
    18732092  if [ ${status} -gt 0 ] ; then 
    1874       echo "IGCM_sys_ncdiff : ncdiff error" 
    1875       IGCM_debug_Exit "ncdiff" 
     2093    echo "IGCM_sys_ncdiff : ncdiff error" 
     2094    IGCM_debug_Exit "ncdiff" 
    18762095  fi 
    18772096 
     
    18792098} 
    18802099 
     2100#D-#================================================== 
     2101#D-function IGCM_sys_ncea 
     2102#D-* Purpose: encapsulate ncea call so as to manage error code and retry 
     2103#D-* Examples: 
     2104#D- 
    18812105function IGCM_sys_ncea { 
    18822106  IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 
     
    19092133 
    19102134  if [ ${status} -gt 0 ] ; then 
    1911       echo "IGCM_sys_ncea : ncea error" 
    1912       IGCM_debug_Exit "ncea" 
     2135    echo "IGCM_sys_ncea : ncea error" 
     2136    IGCM_debug_Exit "ncea" 
    19132137  fi 
    19142138 
     
    19162140} 
    19172141 
     2142#D-#================================================== 
     2143#D-function IGCM_sys_ncecat 
     2144#D-* Purpose: encapsulate ncecat call so as to manage error code and retry 
     2145#D-* Examples: 
     2146#D- 
    19182147function IGCM_sys_ncecat { 
    19192148  IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 
     
    19462175 
    19472176  if [ ${status} -gt 0 ] ; then 
    1948       echo "IGCM_sys_ncecat : ncecat error" 
    1949       IGCM_debug_Exit "ncecat" 
     2177    echo "IGCM_sys_ncecat : ncecat error" 
     2178    IGCM_debug_Exit "ncecat" 
    19502179  fi 
    19512180 
     
    19532182} 
    19542183 
     2184#D-#================================================== 
     2185#D-function IGCM_sys_ncflint 
     2186#D-* Purpose: encapsulate ncflint call so as to manage error code and retry 
     2187#D-* Examples: 
     2188#D- 
    19552189function IGCM_sys_ncflint { 
    19562190  IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 
     
    19832217 
    19842218  if [ ${status} -gt 0 ] ; then 
    1985       echo "IGCM_sys_ncflint : ncflint error" 
    1986       IGCM_debug_Exit "ncflint" 
     2219    echo "IGCM_sys_ncflint : ncflint error" 
     2220    IGCM_debug_Exit "ncflint" 
    19872221  fi 
    19882222 
     
    19902224} 
    19912225 
     2226#D-#================================================== 
     2227#D-function IGCM_sys_ncks 
     2228#D-* Purpose: encapsulate ncks call so as to manage error code and retry 
     2229#D-* Examples: 
     2230#D- 
    19922231function IGCM_sys_ncks { 
    19932232  IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 
     
    20202259 
    20212260  if [ ${status} -gt 0 ] ; then 
    2022       echo "IGCM_sys_ncks : ncks error" 
    2023       IGCM_debug_Exit "ncks" 
     2261    echo "IGCM_sys_ncks : ncks error" 
     2262    IGCM_debug_Exit "ncks" 
    20242263  fi 
    20252264 
     
    20272266} 
    20282267 
     2268#D-#================================================== 
     2269#D-function IGCM_sys_ncpdq 
     2270#D-* Purpose: encapsulate ncpdq call so as to manage error code and retry 
     2271#D-* Examples: 
     2272#D- 
    20292273function IGCM_sys_ncpdq { 
    20302274  IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 
     
    20572301 
    20582302  if [ ${status} -gt 0 ] ; then 
    2059       echo "IGCM_sys_ncpdq : ncpdq error" 
    2060       IGCM_debug_Exit "ncpdq" 
     2303    echo "IGCM_sys_ncpdq : ncpdq error" 
     2304    IGCM_debug_Exit "ncpdq" 
    20612305  fi 
    20622306 
     
    20642308} 
    20652309 
     2310#D-#================================================== 
     2311#D-function IGCM_sys_ncra 
     2312#D-* Purpose: encapsulate ncra call so as to manage error code and retry 
     2313#D-* Examples: 
     2314#D- 
    20662315function IGCM_sys_ncra { 
    20672316  IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 
     
    20942343 
    20952344  if [ ${status} -gt 0 ] ; then 
    2096       echo "IGCM_sys_ncra : ncra error" 
    2097       IGCM_debug_Exit "ncra" 
     2345    echo "IGCM_sys_ncra : ncra error" 
     2346    IGCM_debug_Exit "ncra" 
    20982347  fi 
    20992348 
     
    21012350} 
    21022351 
     2352#D-#================================================== 
     2353#D-function IGCM_sys_ncrcat 
     2354#D-* Purpose: encapsulate ncrcat call so as to manage error code and retry 
     2355#D-* Examples: 
     2356#D- 
    21032357function IGCM_sys_ncrcat { 
    21042358  IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 
     
    21072361  fi 
    21082362 
    2109   typeset NB_ESSAI DELAI status i 
     2363  typeset NB_ESSAI DELAI status i lastArg 
    21102364  # number of tentative 
    21112365  NB_ESSAI=3 
     
    21232377      IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    21242378      sleep $DELAI 
     2379    elif [ ! "X$( grep "WARNING Intra-file non-monotonicity" out_rsync )" = "X" ] ; then 
     2380      IGCM_debug_Print 2 "IGCM_sys_ncrcat : WARNING Intra-file non-monotonicity" 
     2381      cat out_rsync 
     2382      # remove files having corrupted time axis 
     2383      eval lastArg=\${$#} 
     2384      IGCM_debug_Print 2 "IGCM_sys_ncrcat : Delete ${lastArg}" 
     2385      \rm ${lastArg} 
     2386      \rm out_rsync 
     2387      IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
     2388      sleep $DELAI 
    21252389    else 
    21262390      \rm out_rsync 
     
    21312395 
    21322396  if [ ${status} -gt 0 ] ; then 
    2133       echo "IGCM_sys_ncrcat : ncrcat error" 
    2134       #IGCM_debug_Exit "ncrcat" 
     2397    echo "IGCM_sys_ncrcat : ncrcat error" 
     2398    #IGCM_debug_Exit "ncrcat" 
    21352399  fi 
    21362400 
     
    21382402} 
    21392403 
     2404#D-#================================================== 
     2405#D-function IGCM_sys_ncrename 
     2406#D-* Purpose: encapsulate ncrename call so as to manage error code and retry 
     2407#D-* Examples: 
     2408#D- 
    21402409function IGCM_sys_ncrename { 
    21412410  IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 
     
    21682437 
    21692438  if [ ${status} -gt 0 ] ; then 
    2170       echo "IGCM_sys_ncrename : ncrename error" 
    2171       IGCM_debug_Exit "ncrename" 
     2439    echo "IGCM_sys_ncrename : ncrename error" 
     2440    IGCM_debug_Exit "ncrename" 
    21722441  fi 
    21732442 
     
    21752444} 
    21762445 
     2446#D-#================================================== 
     2447#D-function IGCM_sys_ncwa 
     2448#D-* Purpose: encapsulate ncwa call so as to manage error code and retry 
     2449#D-* Examples: 
     2450#D- 
    21772451function IGCM_sys_ncwa { 
    21782452  IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 
     
    22052479 
    22062480  if [ ${status} -gt 0 ] ; then 
    2207       echo "IGCM_sys_ncwa : ncwa error" 
    2208       IGCM_debug_Exit "ncwa" 
     2481    echo "IGCM_sys_ncwa : ncwa error" 
     2482    IGCM_debug_Exit "ncwa" 
    22092483  fi 
    22102484 
     
    22152489# CDO OPERATOR 
    22162490 
     2491#D-#================================================== 
     2492#D-function IGCM_sys_cdo 
     2493#D-* Purpose: encapsulate cdo call so as to manage error code and retry 
     2494#D-* Examples: 
     2495#D- 
    22172496function IGCM_sys_cdo { 
    22182497  IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_iitm.ksh

    r810 r811  
    210210function IGCM_sys_RshArchive { 
    211211  IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 
    212   DEBUG_sys=false IGCM_sys_IsFileArchived "$@" 
    213   if [ $? = 0 ] ; then 
    214     /bin/ksh <<-EOF 
     212  /bin/ksh <<-EOF 
    215213    ${@} 
    216214EOF 
    217     status=$? 
    218   else 
    219     /bin/ksh <<-EOF 
    220     ${@} 
    221 EOF 
    222     status=$? 
    223   fi 
     215  status=$? 
    224216  if [ ${status} -gt 0 ] ; then 
    225217    IGCM_debug_Print 2 "IGCM_sys_RshArchive : command failed error code ${status}" 
     
    547539  fi 
    548540 
    549   \ls -r $@ 
     541  \tree -f $@ 
    550542 
    551543  IGCM_debug_PopStack "IGCM_sys_Tree" 
     
    596588  IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 
    597589 
    598   typeset ERROR 
    599   ERROR=0 
     590  typeset status 
    600591 
    601592  if ( $DEBUG_sys ) ; then 
     
    606597  [ ${#@} = 2 ] &&  REP_FOR_JOB=${2} 
    607598  sed -e "s:\# \@ output *= .*:\# \@ output = ${Script_Output}:" \ 
    608       -e "s:\# \@ error *= .*:\# \@ error = ${Script_Output}:"   \ 
    609       $1 > ${REP_FOR_JOB}/JOB_FOR_IGCM 
    610   cd $REP_FOR_JOB ; /usr/lpp/LoadL/full/bin/llsubmit JOB_FOR_IGCM ; ERROR=$? ; cd - ; 
    611  
    612   if [ ${ERROR} -gt 0 ] ; then 
    613     echo "IGCM_sys_Qsub : erreur $@" 
     599    -e "s:\# \@ error *= .*:\# \@ error = ${Script_Output}:"   \ 
     600    $1 > ${REP_FOR_JOB}/JOB_FOR_IGCM 
     601  cd $REP_FOR_JOB ; /usr/lpp/LoadL/full/bin/llsubmit JOB_FOR_IGCM ; status=$? ; cd - ; 
     602 
     603  if [ ${status} -gt 0 ] ; then 
     604    IGCM_debug_Print 2 "IGCM_sys_Qsub $1 : error code ${status}" 
    614605    IGCM_debug_Exit "IGCM_sys_Qsub" 
    615606  else 
     
    627618  IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 
    628619 
    629   typeset ERROR 
    630   ERROR=0 
     620  typeset status 
    631621 
    632622  if ( $DEBUG_sys ) ; then 
     
    638628 
    639629  sed -e "s:\# \@ output *= .*:\# \@ output = ${Script_Post_Output}.out:" \ 
    640       -e "s:\# \@ error *= .*:\# \@ error = ${Script_Post_Output}.out:"   \ 
    641       ${libIGCM_POST}/$1.job > ${REP_FOR_JOB}/JOB_FOR_IGCM 
    642  
    643   cd $REP_FOR_JOB ; /usr/lpp/LoadL/full/bin/llsubmit JOB_FOR_IGCM ; ERROR=$? ; cd - ; 
    644   if [ ${ERROR} -gt 0 ] ; then 
    645     echo "IGCM_sys_QsubPost : erreur $@." 
     630    -e "s:\# \@ error *= .*:\# \@ error = ${Script_Post_Output}.out:"   \ 
     631    ${libIGCM_POST}/$1.job > ${REP_FOR_JOB}/JOB_FOR_IGCM 
     632 
     633  cd $REP_FOR_JOB ; /usr/lpp/LoadL/full/bin/llsubmit JOB_FOR_IGCM ; status=$? ; cd - ; 
     634  if [ ${status} -gt 0 ] ; then 
     635    IGCM_debug_Print 2 "IGCM_sys_QsubPost $1 : error code ${status}" 
    646636    IGCM_debug_Exit "IGCM_sys_QsubPost" 
    647637  else 
    648638    IGCM_sys_Rm ${REP_FOR_JOB}/JOB_FOR_IGCM 
    649639  fi 
    650  
    651640  IGCM_debug_PopStack "IGCM_sys_QsubPost" 
    652641} 
     
    872861    \rm out_rsync 
    873862  fi 
    874  
    875863  IGCM_debug_PopStack "IGCM_sys_RmRunDir" 
    876864} 
     
    967955    typeset status 
    968956 
    969       #USUAL WAY 
    970     \cp -rp $1 $2 > out_rsync 2>&1 
     957    #USUAL WAY 
     958    \cp -ur $1 $2 > out_rsync 2>&1 
    971959    status=$? 
    972960 
     
    11581146    # 
    11591147    IGCM_sys_MkdirArchive $( dirname $2 ) 
    1160     # 
    1161     typeset RET 
    11621148    # 
    11631149    if [ X${JobType} = XRUN ] ; then 
     
    13121298      return 
    13131299    fi 
    1314  
    1315     # SD : dm_liste is not suited for computing job 
    1316     #      because we change filename during transfert 
    1317     #      dm_liste is better suited for post-treatment 
    1318     #dm_liste=" " 
    1319     #(( ifile=1 )) 
    1320     #while [ $ifile -lt $# ] ; do 
    1321     #    dm_liste=$( eval echo ${dm_liste} " "\${${ifile}} ) 
    1322     #    (( ifile = ifile + 1 )) 
    1323     #done 
    1324     #DEST=$( eval echo \${${#}} ) 
    13251300 
    13261301    #USUAL WAY 
     
    14531428 
    14541429#D-#================================================== 
     1430#D-function IGCM_sys_Dods_Rm 
     1431#D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. 
     1432#D-* Examples: 
     1433#D- 
     1434function IGCM_sys_Dods_Rm { 
     1435  if ( $DEBUG_sys ) ; then 
     1436    echo "IGCM_sys_Dods_Rm :" $@ 
     1437  fi 
     1438  return 0 
     1439} 
     1440 
     1441#D-#================================================== 
     1442#D-function IGCM_sys_Dods_Cp 
     1443#D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole. 
     1444#D-* Examples: 
     1445#D- 
     1446function IGCM_sys_Dods_Cp { 
     1447  if ( $DEBUG_sys ) ; then 
     1448    echo "IGCM_sys_Dods_Cp :" $@ 
     1449  fi 
     1450  return 0 
     1451} 
     1452 
     1453#D-#================================================== 
    14551454#D-function IGCM_sys_Put_Dods 
    14561455#D-* Purpose: Put ${ARCHIVE} files on DODS internet protocole. Dummy function here 
     
    16191618  IGCM_debug_PushStack "IGCM_sys_activ_variables" 
    16201619  if ( $DEBUG_sys ) ; then 
    1621     echo "IGCM_sys_activ_variables " 
     1620    echo "IGCM_sys_activ_variables" 
    16221621  fi 
    16231622 
     
    16441643  IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 
    16451644  if ( $DEBUG_sys ) ; then 
    1646     echo "IGCM_sys_desactiv_variables " 
     1645    echo "IGCM_sys_desactiv_variables" 
    16471646  fi 
    16481647# -------------------------------------------------------------------- 
     
    16671666function IGCM_sys_build_run_file { 
    16681667 
    1669 IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 
     1668  IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 
    16701669 
    16711670} 
     
    18311830  fi 
    18321831 
    1833   IGCM_debug_Print 1 "sys iitm : execution command is " 
     1832  IGCM_debug_Print 1 "sys iitm : execution command is" 
    18341833  IGCM_debug_Print 1 "$EXECUTION" 
    18351834 
     
    19111910 
    19121911  if [ ${status} -gt 0 ] ; then 
    1913       echo "IGCM_sys_ncap2 : ncap2 error" 
    1914       IGCM_debug_Exit "ncap2" 
     1912    echo "IGCM_sys_ncap2 : ncap2 error" 
     1913    IGCM_debug_Exit "ncap2" 
    19151914  fi 
    19161915 
     
    19531952 
    19541953  if [ ${status} -gt 0 ] ; then 
    1955       echo "IGCM_sys_ncatted : ncatted error" 
    1956       IGCM_debug_Exit "ncatted" 
     1954    echo "IGCM_sys_ncatted : ncatted error" 
     1955    IGCM_debug_Exit "ncatted" 
    19571956  fi 
    19581957 
     
    19951994 
    19961995  if [ ${status} -gt 0 ] ; then 
    1997       echo "IGCM_sys_ncbo : ncbo error" 
    1998       IGCM_debug_Exit "ncbo" 
     1996    echo "IGCM_sys_ncbo : ncbo error" 
     1997    IGCM_debug_Exit "ncbo" 
    19991998  fi 
    20001999 
     
    20372036 
    20382037  if [ ${status} -gt 0 ] ; then 
    2039       echo "IGCM_sys_ncdiff : ncdiff error" 
    2040       IGCM_debug_Exit "ncdiff" 
     2038    echo "IGCM_sys_ncdiff : ncdiff error" 
     2039    IGCM_debug_Exit "ncdiff" 
    20412040  fi 
    20422041 
     
    20792078 
    20802079  if [ ${status} -gt 0 ] ; then 
    2081       echo "IGCM_sys_ncea : ncea error" 
    2082       IGCM_debug_Exit "ncea" 
     2080    echo "IGCM_sys_ncea : ncea error" 
     2081    IGCM_debug_Exit "ncea" 
    20832082  fi 
    20842083 
     
    21212120 
    21222121  if [ ${status} -gt 0 ] ; then 
    2123       echo "IGCM_sys_ncecat : ncecat error" 
    2124       IGCM_debug_Exit "ncecat" 
     2122    echo "IGCM_sys_ncecat : ncecat error" 
     2123    IGCM_debug_Exit "ncecat" 
    21252124  fi 
    21262125 
     
    21632162 
    21642163  if [ ${status} -gt 0 ] ; then 
    2165       echo "IGCM_sys_ncflint : ncflint error" 
    2166       IGCM_debug_Exit "ncflint" 
     2164    echo "IGCM_sys_ncflint : ncflint error" 
     2165    IGCM_debug_Exit "ncflint" 
    21672166  fi 
    21682167 
     
    22052204 
    22062205  if [ ${status} -gt 0 ] ; then 
    2207       echo "IGCM_sys_ncks : ncks error" 
    2208       IGCM_debug_Exit "ncks" 
     2206    echo "IGCM_sys_ncks : ncks error" 
     2207    IGCM_debug_Exit "ncks" 
    22092208  fi 
    22102209 
     
    22472246 
    22482247  if [ ${status} -gt 0 ] ; then 
    2249       echo "IGCM_sys_ncpdq : ncpdq error" 
    2250       IGCM_debug_Exit "ncpdq" 
     2248    echo "IGCM_sys_ncpdq : ncpdq error" 
     2249    IGCM_debug_Exit "ncpdq" 
    22512250  fi 
    22522251 
     
    22892288 
    22902289  if [ ${status} -gt 0 ] ; then 
    2291       echo "IGCM_sys_ncra : ncra error" 
    2292       IGCM_debug_Exit "ncra" 
     2290    echo "IGCM_sys_ncra : ncra error" 
     2291    IGCM_debug_Exit "ncra" 
    22932292  fi 
    22942293 
     
    23412340 
    23422341  if [ ${status} -gt 0 ] ; then 
    2343       echo "IGCM_sys_ncrcat : ncrcat error" 
     2342    echo "IGCM_sys_ncrcat : ncrcat error" 
    23442343      #IGCM_debug_Exit "ncrcat" 
    23452344  fi 
     
    23832382 
    23842383  if [ ${status} -gt 0 ] ; then 
    2385       echo "IGCM_sys_ncrename : ncrename error" 
    2386       IGCM_debug_Exit "ncrename" 
     2384    echo "IGCM_sys_ncrename : ncrename error" 
     2385    IGCM_debug_Exit "ncrename" 
    23872386  fi 
    23882387 
     
    24252424 
    24262425  if [ ${status} -gt 0 ] ; then 
    2427       echo "IGCM_sys_ncwa : ncwa error" 
    2428       IGCM_debug_Exit "ncwa" 
     2426    echo "IGCM_sys_ncwa : ncwa error" 
     2427    IGCM_debug_Exit "ncwa" 
    24292428  fi 
    24302429 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh

    r809 r811  
    123123 
    124124#==================================================== 
    125 #- ARCHIVE (dedicated to large files) 
     125#- ARCHIVE 
    126126typeset ARCHIVE=${ARCHIVE:=/home/scratch01/${LOGIN}} 
    127127 
     
    173173#D- 
    174174function IGCM_sys_ChangeArchive { 
    175  
    176175  IGCM_debug_Print 1 " dummy function : IGCM_sys_ChangeArchive " 
    177  
    178176} 
    179177 
     
    209207    ${@} 
    210208EOF 
    211   if [ $? -gt 0 ] ; then 
    212     echo "IGCM_sys_RshArchive : erreur." 
     209  status=$? 
     210  if [ ${status} -gt 0 ] ; then 
     211    IGCM_debug_Print 2 "IGCM_sys_RshArchive : command failed error code ${status}" 
    213212    IGCM_debug_Exit "IGCM_sys_RshArchive" 
    214213  fi 
     
    227226  fi 
    228227 
    229   #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL 
    230   #cat tmp_IGCM_sys_RshPost_$$ 
    231228  # keep standard input (stdin) for the loop onto temporary file 
    232229  cat >tmp_IGCM_sys_RshPost_$$ 
     
    234231# ============ FRONTEND START ============ # 
    235232 
    236     ssh obelix3 exec /bin/ksh <tmp_IGCM_sys_RshPost_$$ 
     233  ssh obelix3 exec /bin/ksh <tmp_IGCM_sys_RshPost_$$ 
    237234  if [ $? -gt 0 ] ; then 
    238235    echo "IGCM_sys_RshPost : erreur." 
     
    279276  fi 
    280277 
     278  sleep 10 
     279  rm -f job_end.mail 
     280 
    281281  if [ $? -gt 0 ] ; then 
    282282    echo "IGCM_sys_SendMail : erreur." 
     
    323323  #- creation de repertoire sur le serveur fichier 
    324324  if [ ! -d ${1} ]; then 
    325     \mkdir -p $1 
    326     if [ $? -gt 0 ] ; then 
    327       echo "IGCM_sys_MkdirArchive : erreur." 
     325    mkdir -p $1 
     326    status=$? 
     327 
     328    if [ ${status} -gt 0 ] ; then 
     329      IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}" 
    328330      IGCM_debug_Exit "IGCM_sys_MkdirArchive" 
    329331    fi 
     
    437439  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 
    438440  IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 
    439  
    440441  return ${ExistFlag} 
    441442} 
     
    577578    echo "IGCM_sys_Qsub :" $@ 
    578579  fi 
     580  typeset status 
    579581  /usr/local/bin/qsub -q medium -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1 
    580   if [ $? -gt 0 ] ; then 
    581     echo "IGCM_sys_Qsub : erreur." 
     582  status=$? 
     583  if [ ${status} -gt 0 ] ; then 
     584    IGCM_debug_Print 2 "IGCM_sys_Qsub $1 : error code ${status}" 
    582585    IGCM_debug_Exit "IGCM_sys_Qsub" 
    583586  fi 
     
    595598    echo "IGCM_sys_QsubPost :" $@ 
    596599  fi 
     600  typeset status 
    597601  /usr/local/bin/qsub -q medium -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM_POST}/$1.job -v ${listVarEnv} 
    598   if [ $? -gt 0 ] ; then 
    599     echo "IGCM_sys_QsubPost : erreur " $@ 
     602  status=$? 
     603  if [ ${status} -gt 0 ] ; then 
     604    IGCM_debug_Print 2 "IGCM_sys_QsubPost $1 : error code ${status}" 
    600605    IGCM_debug_Exit "IGCM_sys_QsubPost" 
    601606  fi 
     
    719724 
    720725#D-#================================================== 
     726#D-function IGCM_sys_Miror_libIGCM 
     727#D-* Purpose: Mirror libIGCM PATH and lib to frontend 
     728#D-* Examples: 
     729#D- 
     730function IGCM_sys_Mirror_libIGCM { 
     731  IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" 
     732  if ( $DEBUG_sys ) ; then 
     733    echo "IGCM_sys_Mirror_libIGCM" 
     734  fi 
     735 
     736  typeset status 
     737 
     738  mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} 
     739 
     740  echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 
     741  ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 
     742  status=$? 
     743 
     744  if [ ${status} -gt 0 ] ; then 
     745    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend." 
     746    cat out_rsync 
     747  fi 
     748  IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" 
     749} 
     750 
     751#D-#================================================== 
    721752#D-function IGCM_sys_Cp 
    722753#D-* Purpose: generic cp 
     
    791822 
    792823  if [ ${status} -gt 0 ] ; then 
    793     echo "IGCM_sys_RmRunDir : error code ${status}" 
     824    echo "IGCM_sys_RmRunDir : rm error code is ${status}." 
    794825    cat out_rsync 
    795826    IGCM_debug_Exit "IGCM_sys_RmRunDir" 
     
    860891 
    861892    if [ ${status} -gt 0 ] ; then 
    862       echo "IGCM_sys_Put_Dir : error code ${status}" 
     893      IGCM_debug_Print 2 "IGCM_sys_Put_Dir : cp failed error code ${status}" 
    863894      cat out_rsync 
    864895      IGCM_debug_Exit "IGCM_sys_Put_Dir" 
     
    892923 
    893924    #USUAL WAY 
    894     \cp -R $1 $2 > out_rsync 2>&1 
     925    \cp -ur $1 $2 > out_rsync 2>&1 
    895926    status=$? 
    896927 
    897928    if [ ${status} -gt 0 ] ; then 
    898       echo "IGCM_sys_Get_Dir : error." 
     929      IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status}" 
    899930      cat out_rsync 
    900931      IGCM_debug_Exit "IGCM_sys_Get_Dir" 
     
    925956    fi 
    926957 
    927     typeset status 
    928  
    929     #USUAL WAY 
    930     cp -RL $1 $2 > out_rsync 2>&1 
    931     status=$? 
     958    typeset NB_ESSAI DELAI status i 
     959    # number of tentative 
     960    NB_ESSAI=3 
     961    # time delay between tentative 
     962    DELAI=2 
     963 
     964    i=0 
     965    while [ $i -lt $NB_ESSAI ] ; do 
     966      \cp -urL $1 $2 > out_rsync 2>&1 
     967      status=$? 
     968      if [ ${status} -gt 0 ]; then 
     969        IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     970        IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." 
     971        sleep $DELAI 
     972      else 
     973        break 
     974      fi 
     975      (( i = i + 1 )) 
     976    done 
    932977 
    933978    if [ ${status} -gt 0 ] ; then 
     
    936981      IGCM_debug_Exit "IGCM_sys_Get_Master" 
    937982    else 
    938       rm out_rsync 
     983      \rm out_rsync 
    939984    fi 
    940985  else 
     
    943988  IGCM_debug_PopStack "IGCM_sys_Get_Master" 
    944989} 
     990 
     991#==================================================== 
     992#- Call IGCM_sys_Mirror_libIGCM now ! 
     993if ( $MirrorlibIGCM ) ; then 
     994  IGCM_sys_Mirror_libIGCM 
     995fi 
    945996 
    946997#D-#================================================== 
     
    9661017      IGCM_sys_Chmod 444 ${1} 
    9671018    fi 
     1019    # 
     1020    # Only if we use rsync 
     1021    #IGCM_sys_MkdirArchive $( dirname $2 ) 
     1022    # 
     1023    #USUAL WAY 
     1024    \cp $1 $2 > out_rsync 2>&1 
     1025    status=$? 
     1026 
     1027#       #RSYNC WITH NETWORK SSH CALL 
     1028#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     1029#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     1030 
     1031#       #RSYNC WITH NFS USE 
     1032#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     1033#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     1034 
     1035#       status=$? 
     1036#       IGCM_sys_Rsync_out $status 
     1037 
     1038#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1039#       (( status=status+$? )) 
     1040 
     1041    if [ ${status} -gt 0 ] ; then 
     1042      echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 
     1043      cat out_rsync 
     1044      IGCM_debug_Exit "IGCM_sys_Put_Rest" 
     1045    else 
     1046      \rm out_rsync 
     1047    fi 
     1048  else 
     1049    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1050  fi 
     1051  IGCM_debug_PopStack "IGCM_sys_Put_Rest" 
     1052} 
     1053 
     1054#D-#================================================== 
     1055#D-function IGCM_sys_PutBuffer_Rest 
     1056#D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 
     1057#D-           File and target directory must exist. 
     1058#D-* Examples: 
     1059#D- 
     1060function IGCM_sys_PutBuffer_Rest { 
     1061  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 
     1062  if ( $DEBUG_sys ) ; then 
     1063    echo "IGCM_sys_PutBuffer_Rest :" $@ 
     1064  fi 
     1065  if [ $DRYRUN = 0 ]; then 
     1066    if [ ! -f ${1} ] ; then 
     1067      echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 
     1068      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     1069    fi 
     1070 
     1071    typeset status 
     1072    # 
     1073    if [ X${JobType} = XRUN ] ; then 
     1074      IGCM_sys_Chmod 444 ${1} 
     1075    fi 
    9681076 
    9691077    # 
     
    9721080    status=$? 
    9731081 
    974 #       #RSYNC WITH NETWORK SSH CALL 
    975 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
    976 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
    977  
    978 #       #RSYNC WITH NFS USE 
    979 #       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
    980 #       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    981  
    982 #       status=$? 
    983 #       IGCM_sys_Rsync_out $status 
    984  
    985 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    986 #       (( status=status+$? )) 
    987  
    988     if [ ${status} -gt 0 ] ; then 
    989       echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 
    990       cat out_rsync 
    991       IGCM_debug_Exit "IGCM_sys_Put_Rest" 
    992     else 
    993       \rm out_rsync 
    994     fi 
    995   else 
    996     ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    997   fi 
    998   IGCM_debug_PopStack "IGCM_sys_Put_Rest" 
    999 } 
    1000  
    1001 #D-#================================================== 
    1002 #D-function IGCM_sys_PutBuffer_Rest 
    1003 #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 
    1004 #D-           File and target directory must exist. 
    1005 #D-* Examples: 
    1006 #D- 
    1007 function IGCM_sys_PutBuffer_Rest { 
    1008   IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 
    1009   if ( $DEBUG_sys ) ; then 
    1010     echo "IGCM_sys_PutBuffer_Rest :" $@ 
    1011   fi 
    1012   if [ $DRYRUN = 0 ]; then 
    1013     if [ ! -f ${1} ] ; then 
    1014       echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 
    1015       IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
    1016     fi 
    1017  
    1018     typeset status 
    1019     # 
    1020     if [ X${JobType} = XRUN ] ; then 
    1021       IGCM_sys_Chmod 444 ${1} 
    1022     fi 
    1023  
    1024     # 
    1025     # USUAL WAY 
    1026     \cp $1 $2 > out_rsync 2>&1 
    1027     status=$? 
    1028  
    10291082    if [ ${status} -gt 0 ] ; then 
    10301083      echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 
     1084      [ -f ${2} ] && ls -l ${2} 
     1085      [ -f ${2}/${1} ] && ls -l ${2}/${1} 
    10311086      cat out_rsync 
    10321087      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     
    10611116    echo "IGCM_sys_Put_Out :" $@ 
    10621117  fi 
     1118 
     1119  typeset status 
     1120 
    10631121  if [ $DRYRUN = 0 ]; then 
    1064     if [ -f ${1} ] ; then 
    1065       if [ ! -d $( dirname $2 ) ] ; then 
    1066         IGCM_sys_MkdirArchive $( dirname $2 ) 
    1067       fi 
    1068     else 
     1122    if [ ! -f ${1} ] ; then 
    10691123      echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 
    10701124      IGCM_debug_PopStack "IGCM_sys_Put_Out" 
    10711125      return 1 
    10721126    fi 
    1073  
    1074     typeset status 
     1127    # 
     1128    IGCM_sys_MkdirArchive $( dirname $2 ) 
    10751129    # 
    10761130    if [ X${JobType} = XRUN ] ; then 
     
    10901144 
    10911145    if [ ${status} -gt 0 ] ; then 
    1092       echo "IGCM_sys_Put_Out : error." 
     1146      IGCM_debug_Print 2 "IGCM_sys_Put_Out : rsync failed error code ${status}" 
    10931147      cat out_rsync 
    10941148      IGCM_debug_Exit "IGCM_sys_Put_Out" 
     
    11141168  fi 
    11151169 
    1116   typeset status 
     1170  typeset NB_ESSAI DELAI status i exist skip 
     1171 
     1172  # number of tentative 
     1173  NB_ESSAI=3 
     1174  # time delay between tentative 
     1175  DELAI=2 
    11171176 
    11181177  if [ $DRYRUN = 0 ]; then 
     
    11261185    # 
    11271186 
    1128     if [ X${JobType} = XRUN ] ; then 
    1129       if [ X${3} = X ] ; then 
    1130         IGCM_sys_Chmod 444 ${1} 
     1187    exist=false 
     1188    skip=false 
     1189    if [ -f $2 ] ; then 
     1190      IGCM_debug_Print 1 "$2 already exist" 
     1191      exist=true 
     1192      if [ "X$( diff $1 $2 )" = X ] ; then 
     1193        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 
     1194        status=0 
     1195        skip=true 
     1196      else 
     1197        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 
     1198        skip=false 
    11311199      fi 
    11321200    fi 
    11331201    # 
    1134     # USUAL WAY 
    1135     \cp $1 $2 > out_rsync 2>&1 
    1136     status=$? 
     1202    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 
     1203      IGCM_sys_Chmod u+w $2 
     1204    fi 
     1205 
     1206    if [ X${skip} = Xfalse ] ; then 
     1207      i=0 
     1208      while [ $i -lt $NB_ESSAI ] ; do 
     1209        # USUAL WAY 
     1210        \cp $1 $2 > out_rsync 2>&1 
     1211        status=$? 
     1212        if [ ${status} -gt 0 ]; then 
     1213          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1214          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again." 
     1215          [ -f ${2} ] && ls -l ${2} 
     1216          [ -f ${2}/${1} ] && ls -l ${2}/${1} 
     1217          sleep $DELAI 
     1218        else 
     1219          break 
     1220        fi 
     1221        (( i = i + 1 )) 
     1222      done 
     1223    fi 
    11371224 
    11381225    if [ ${status} -gt 0 ] ; then 
    11391226      echo "IGCM_sys_PutBuffer_Out : error." 
     1227      [ -f ${2} ] && ls -l ${2} 
     1228      [ -f ${2}/${1} ] && ls -l ${2}/${1} 
    11401229      cat out_rsync 
    11411230      IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 
    11421231    else 
     1232 
     1233      if [ X${JobType} = XRUN ] ; then 
     1234        if [ X${3} = X ] ; then 
     1235          [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} 
     1236          [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} 
     1237        fi 
     1238      fi 
     1239 
    11431240      \rm out_rsync 
    11441241    fi 
     
    11581255  IGCM_debug_PushStack "IGCM_sys_Get" $@ 
    11591256 
    1160   typeset DEST RET status dm_liste ifile target 
     1257  typeset DEST status dm_liste 
    11611258 
    11621259  if ( $DEBUG_sys ) ; then 
     
    11781275      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 
    11791276      IGCM_debug_Exit "IGCM_sys_Get" 
    1180       #return 
    1181     fi 
    1182  
    1183     (( RET=0 )) 
    1184     for target in ${dm_liste[*]} ; do 
    1185       \cp ${target} ${DEST} >> out_rsync 2>&1 
    1186       (( RET=RET+$? )) 
    1187     done 
    1188  
    1189 #       echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1 
    1190 #       ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1 
    1191 #       status=$? 
    1192 #       IGCM_sys_Rsync_out $status 
    1193  
    1194 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1195 #       (( RET=RET+$? )) 
    1196  
    1197     if [ ${RET} -gt 0 ] ; then 
    1198       echo "IGCM_sys_Get : error" 
     1277      return 
     1278    fi 
     1279 
     1280    #USUAL WAY 
     1281    \cp ${dm_liste[*]} ${DEST} > out_rsync 2>&1 
     1282    status=$? 
     1283 
     1284    if [ ${status} -gt 0 ] ; then 
     1285      IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status}" 
    11991286      cat out_rsync 
    1200       \rm out_rsync 
    12011287      IGCM_debug_Exit "IGCM_sys_Get" 
    12021288    else 
     
    12171303  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
    12181304 
    1219   typeset DEST RET status buf_liste ifile target file_work 
     1305  typeset DEST buf_liste target file_work 
     1306  typeset NB_ESSAI DELAI status i 
    12201307 
    12211308  if ( $DEBUG_sys ) ; then 
    12221309    echo "IGCM_sys_GetBuffer :" $@ 
    12231310  fi 
     1311 
     1312  # number of tentative 
     1313  NB_ESSAI=3 
     1314  # time delay between tentative 
     1315  DELAI=2 
     1316 
    12241317  if [ $DRYRUN -le 2 ]; then 
    12251318    if [ X${1} = X'/l' ] ; then 
     
    12331326    #USUAL WAY 
    12341327    if [ X${1} = X'/l' ] ; then 
    1235       (( RET=0 )) 
    12361328      for target in ${buf_liste[*]} ; do 
    12371329        local_file=$( basename ${target} ) 
    1238         \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1239         (( RET = RET + $? )) 
     1330        i=0 
     1331        while [ $i -lt $NB_ESSAI ] ; do 
     1332          \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1333          status=$? 
     1334          if [ ${status} -gt 0 ]; then 
     1335            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1336            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." 
     1337            sleep $DELAI 
     1338          else 
     1339            break 
     1340          fi 
     1341          (( i = i + 1 )) 
     1342        done 
     1343        if [ ${status} -gt 0 ] ; then 
     1344          echo "IGCM_sys_Get : error" 
     1345          cat out_rsync 
     1346          \rm out_rsync 
     1347          IGCM_debug_Exit "IGCM_sys_GetBuffer" 
     1348        else 
     1349          \rm out_rsync 
     1350        fi 
    12401351      done 
    12411352    else 
    1242       \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
    1243       status=$? 
    1244     fi 
    1245  
    1246     if [ ${RET} -gt 0 ] ; then 
    1247       echo "IGCM_sys_GetBuffer : error" 
    1248       cat out_rsync 
    1249       \rm out_rsync 
    1250       IGCM_debug_Exit "IGCM_sys_GetBuffer" 
    1251     else 
    1252       \rm out_rsync 
     1353      i=0 
     1354      while [ $i -lt $NB_ESSAI ] ; do 
     1355        \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
     1356        status=$? 
     1357        if [ ${status} -gt 0 ]; then 
     1358          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1359          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." 
     1360          sleep $DELAI 
     1361        else 
     1362          break 
     1363        fi 
     1364        (( i = i + 1 )) 
     1365      done 
     1366      if [ ${status} -gt 0 ] ; then 
     1367        echo "IGCM_sys_Get : error" 
     1368        cat out_rsync 
     1369        \rm out_rsync 
     1370        IGCM_debug_Exit "IGCM_sys_GetBuffer" 
     1371      else 
     1372        \rm out_rsync 
     1373      fi 
    12531374    fi 
    12541375  else 
     
    13191440#D-#================================================== 
    13201441#D-function IGCM_sys_Put_Dods 
    1321 #D-* Purpose: Put $(ARCHIVE) files on DODS internet protocole. 
     1442#D-* Purpose: Put ${ARCHIVE} files on DODS internet protocole. Dummy function here 
    13221443#D-* Examples: 
    13231444#D- 
     
    13331454# REBUILD OPERATOR 
    13341455 
     1456#D-#================================================== 
     1457#D-function IGCM_sys_rebuild 
     1458#D-* Purpose: rebuild parallel files 
     1459#D-* Examples: 
     1460#D- 
    13351461function IGCM_sys_rebuild { 
    13361462  IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 
     
    13391465  fi 
    13401466 
    1341   typeset status 
    1342  
    1343   /home/users/igcmg/rebuild/bin/rebuild -f -o $@ 
    1344   status=$? 
     1467  typeset NB_ESSAI DELAI status i firstArg 
     1468  # number of tentative 
     1469  NB_ESSAI=3 
     1470  # time delay between tentative 
     1471  DELAI=2 
     1472 
     1473  i=0 
     1474  while [ $i -lt $NB_ESSAI ] ; do 
     1475    /home/users/igcmg/rebuild/bin/rebuild -f -o $@ > out_rsync 2>&1 
     1476    status=$? 
     1477    if [ ${status} -gt 0 ] ; then 
     1478      IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 
     1479      cat out_rsync 
     1480      \rm out_rsync 
     1481      IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
     1482      firstArg=${1} 
     1483      \rm ${firstArg} 
     1484      sleep $DELAI 
     1485    else 
     1486      \rm out_rsync 
     1487      break 
     1488    fi 
     1489    (( i = i + 1 )) 
     1490  done 
     1491 
    13451492  if [ ${status} -gt 0 ] ; then 
    1346     IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 
     1493    echo "IGCM_sys_rebuild : rebuild error code is ${status}" 
    13471494    IGCM_debug_Exit "rebuild" 
    13481495  fi 
     
    13511498} 
    13521499 
     1500#D-#================================================== 
     1501#D-function IGCM_sys_rebuild_station 
     1502#D-* Purpose: rebuild parallel files describing station  
     1503#D-* Examples: 
     1504#D- 
    13531505function IGCM_sys_rebuild_station { 
    13541506  IGCM_debug_PushStack "IGCM_sys_rebuild_station" -- $@ 
     
    14451597# Activate Running Environnment Variables 
    14461598 
     1599#D-#================================================== 
     1600#D-function IGCM_sys_desactiv_variables 
     1601#D-* Purpose: set environement variables prior to execution 
     1602#D-* Examples: 
     1603#D- 
    14471604function IGCM_sys_activ_variables { 
    14481605  IGCM_debug_PushStack "IGCM_sys_activ_variables" 
     
    14501607    echo "IGCM_sys_activ_variables" 
    14511608  fi 
     1609 
     1610# -------------------------------------------------------------------- 
     1611#D- MPI specifications 
     1612# -------------------------------------------------------------------- 
     1613 
     1614# -------------------------------------------------------------------- 
     1615#D- Other specifications 
     1616# -------------------------------------------------------------------- 
     1617 
    14521618  IGCM_debug_PopStack "IGCM_sys_activ_variables" 
    14531619} 
     
    14561622# Desactivate Running Environnment Variables 
    14571623 
     1624#D-#================================================== 
     1625#D-function IGCM_sys_desactiv_variables 
     1626#D-* Purpose: unset environement variables after execution 
     1627#D-* Examples: 
     1628#D- 
    14581629function IGCM_sys_desactiv_variables { 
    14591630  IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 
     
    14611632    echo "IGCM_sys_desactiv_variables" 
    14621633  fi 
     1634# -------------------------------------------------------------------- 
     1635#D- MPI specifications 
     1636# -------------------------------------------------------------------- 
     1637 
     1638# -------------------------------------------------------------------- 
     1639#D- Other specifications 
     1640# -------------------------------------------------------------------- 
     1641 
    14631642  IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 
    14641643} 
     
    14671646# Build MPI/OMP scripts run file (dummy function) 
    14681647 
     1648#D-#================================================== 
     1649#D-function IGCM_sys_build_run_file 
     1650#D-* Purpose: build run file (deprecated) 
     1651#D-* Examples: 
     1652#D- 
    14691653function IGCM_sys_build_run_file { 
    14701654 
     
    14751659############################################################ 
    14761660# Build MPI/OMP scripts 
     1661 
     1662#D-#================================================== 
     1663#D-function IGCM_sys_build_execution_scripts 
     1664#D-* Purpose: build execution scripts to be launch by ${HOST_MPIRUN_COMMAND} 
     1665#D-* Examples: 
     1666#D- 
    14771667function IGCM_sys_build_execution_scripts 
    14781668{ 
     
    14861676 
    14871677  if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ]  ; then 
    1488     IGCM_debug_Exit "IGCM_sys_titane build_execution_scripts : Job_${config_UserChoices_JobName} doesn't exist in SUBMIT_DIR : ${SUBMIT_DIR} " 
     1678    IGCM_debug_Exit "IGCM_sys_obelix build_execution_scripts : Job_${config_UserChoices_JobName} don't exist in SUBMIT_DIR : ${SUBMIT_DIR} " 
    14891679  fi 
    14901680 
     
    16751865      done 
    16761866 
    1677         # Then second loop on the components 
     1867      # Then second loop on the components 
    16781868 
    16791869      for comp in ${config_ListOfComponents[*]} ; do 
     
    17271917  fi 
    17281918 
    1729   IGCM_debug_Print 1 "sys Obelix : La commande d execution est " 
    1730   IGCM_debug_Print 1 $EXECUTION 
     1919  IGCM_debug_Print 1 "sys Obelix : execution command is" 
     1920  IGCM_debug_Print 1 "$EXECUTION" 
    17311921 
    17321922  IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" 
     
    17341924 
    17351925############################################################ 
    1736 # Check of space available on temporary filesytems 
     1926# Check of space available on temporary filesytems. Dummy function here 
     1927 
     1928#D-#================================================== 
     1929#D-function IGCM_sys_check_quota. Dummy call here 
     1930#D-* Purpose: check user quota. Stop the simulation if quota above 90% 
     1931#D-* Examples: 
     1932#D- 
    17371933function IGCM_sys_check_quota { 
    17381934  IGCM_debug_PushStack "IGCM_sys_check_quota" 
     
    17431939} 
    17441940 
     1941#D-#================================================== 
     1942#D-function IGCM_sys_CountJobInQueue 
     1943#D-* Purpose: Check if job_name is currently 
     1944#D-  running or in queue 
     1945#D-* Examples: IGCM_sys_CountJobInQueue ${JobName} NbRun 
     1946#D- 
     1947function IGCM_sys_CountJobInQueue { 
     1948  IGCM_debug_PushStack "IGCM_sys_CountJobInQueue" 
     1949  if ( $DEBUG_sys ) ; then 
     1950    echo "IGCM_sys_CountJobInQueue" 
     1951  fi 
     1952  IGCM_debug_PopStack "IGCM_sys_CountJobInQueue" 
     1953} 
     1954 
    17451955############################################################## 
    17461956# NCO OPERATOR 
    17471957 
     1958#D-#================================================== 
     1959#D-function IGCM_sys_ncap2 
     1960#D-* Purpose: encapsulate ncap2 call so as to manage error code and retry 
     1961#D-* Examples: 
     1962#D- 
    17481963function IGCM_sys_ncap2 { 
    17491964  IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 
     
    17761991 
    17771992  if [ ${status} -gt 0 ] ; then 
    1778       echo "IGCM_sys_ncap2 : ncap2 error" 
    1779       IGCM_debug_Exit "ncap2" 
     1993    echo "IGCM_sys_ncap2 : ncap2 error" 
     1994    IGCM_debug_Exit "ncap2" 
    17801995  fi 
    17811996 
     
    17831998} 
    17841999 
     2000#D-#================================================== 
     2001#D-function IGCM_sys_ncatted 
     2002#D-* Purpose: encapsulate ncatted call so as to manage error code and retry 
     2003#D-* Examples: 
     2004#D- 
    17852005function IGCM_sys_ncatted { 
    17862006  IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 
     
    18132033 
    18142034  if [ ${status} -gt 0 ] ; then 
    1815       echo "IGCM_sys_ncatted : ncatted error" 
    1816       IGCM_debug_Exit "ncatted" 
     2035    echo "IGCM_sys_ncatted : ncatted error" 
     2036    IGCM_debug_Exit "ncatted" 
    18172037  fi 
    18182038 
     
    18202040} 
    18212041 
     2042#D-#================================================== 
     2043#D-function IGCM_sys_ncbo 
     2044#D-* Purpose: encapsulate ncbo call so as to manage error code and retry 
     2045#D-* Examples: 
     2046#D- 
    18222047function IGCM_sys_ncbo { 
    18232048  IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 
     
    18502075 
    18512076  if [ ${status} -gt 0 ] ; then 
    1852       echo "IGCM_sys_ncbo : ncbo error" 
    1853       IGCM_debug_Exit "ncbo" 
     2077    echo "IGCM_sys_ncbo : ncbo error" 
     2078    IGCM_debug_Exit "ncbo" 
    18542079  fi 
    18552080 
     
    18572082} 
    18582083 
     2084#D-#================================================== 
     2085#D-function IGCM_sys_ncdif 
     2086#D-* Purpose: encapsulate ncdiff call so as to manage error code and retry 
     2087#D-* Examples: 
     2088#D- 
    18592089function IGCM_sys_ncdiff { 
    18602090  IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 
     
    18872117 
    18882118  if [ ${status} -gt 0 ] ; then 
    1889       echo "IGCM_sys_ncdiff : ncdiff error" 
    1890       IGCM_debug_Exit "ncdiff" 
     2119    echo "IGCM_sys_ncdiff : ncdiff error" 
     2120    IGCM_debug_Exit "ncdiff" 
    18912121  fi 
    18922122 
     
    18942124} 
    18952125 
     2126#D-#================================================== 
     2127#D-function IGCM_sys_ncea 
     2128#D-* Purpose: encapsulate ncea call so as to manage error code and retry 
     2129#D-* Examples: 
     2130#D- 
    18962131function IGCM_sys_ncea { 
    18972132  IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 
     
    19242159 
    19252160  if [ ${status} -gt 0 ] ; then 
    1926       echo "IGCM_sys_ncea : ncea error" 
    1927       IGCM_debug_Exit "ncea" 
     2161    echo "IGCM_sys_ncea : ncea error" 
     2162    IGCM_debug_Exit "ncea" 
    19282163  fi 
    19292164 
     
    19312166} 
    19322167 
     2168#D-#================================================== 
     2169#D-function IGCM_sys_ncecat 
     2170#D-* Purpose: encapsulate ncecat call so as to manage error code and retry 
     2171#D-* Examples: 
     2172#D- 
    19332173function IGCM_sys_ncecat { 
    19342174  IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 
     
    19612201 
    19622202  if [ ${status} -gt 0 ] ; then 
    1963       echo "IGCM_sys_ncecat : ncecat error" 
    1964       IGCM_debug_Exit "ncecat" 
     2203    echo "IGCM_sys_ncecat : ncecat error" 
     2204    IGCM_debug_Exit "ncecat" 
    19652205  fi 
    19662206 
     
    19682208} 
    19692209 
     2210#D-#================================================== 
     2211#D-function IGCM_sys_ncflint 
     2212#D-* Purpose: encapsulate ncflint call so as to manage error code and retry 
     2213#D-* Examples: 
     2214#D- 
    19702215function IGCM_sys_ncflint { 
    19712216  IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 
     
    19982243 
    19992244  if [ ${status} -gt 0 ] ; then 
    2000       echo "IGCM_sys_ncflint : ncflint error" 
    2001       IGCM_debug_Exit "ncflint" 
     2245    echo "IGCM_sys_ncflint : ncflint error" 
     2246    IGCM_debug_Exit "ncflint" 
    20022247  fi 
    20032248 
     
    20052250} 
    20062251 
     2252#D-#================================================== 
     2253#D-function IGCM_sys_ncks 
     2254#D-* Purpose: encapsulate ncks call so as to manage error code and retry 
     2255#D-* Examples: 
     2256#D- 
    20072257function IGCM_sys_ncks { 
    20082258  IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 
     
    20352285 
    20362286  if [ ${status} -gt 0 ] ; then 
    2037       echo "IGCM_sys_ncks : ncks error" 
    2038       IGCM_debug_Exit "ncks" 
     2287    echo "IGCM_sys_ncks : ncks error" 
     2288    IGCM_debug_Exit "ncks" 
    20392289  fi 
    20402290 
     
    20422292} 
    20432293 
     2294#D-#================================================== 
     2295#D-function IGCM_sys_ncpdq 
     2296#D-* Purpose: encapsulate ncpdq call so as to manage error code and retry 
     2297#D-* Examples: 
     2298#D- 
    20442299function IGCM_sys_ncpdq { 
    20452300  IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 
     
    20722327 
    20732328  if [ ${status} -gt 0 ] ; then 
    2074       echo "IGCM_sys_ncpdq : ncpdq error" 
    2075       IGCM_debug_Exit "ncpdq" 
     2329    echo "IGCM_sys_ncpdq : ncpdq error" 
     2330    IGCM_debug_Exit "ncpdq" 
    20762331  fi 
    20772332 
     
    20792334} 
    20802335 
     2336#D-#================================================== 
     2337#D-function IGCM_sys_ncra 
     2338#D-* Purpose: encapsulate ncra call so as to manage error code and retry 
     2339#D-* Examples: 
     2340#D- 
    20812341function IGCM_sys_ncra { 
    20822342  IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 
     
    21092369 
    21102370  if [ ${status} -gt 0 ] ; then 
    2111       echo "IGCM_sys_ncra : ncra error" 
    2112       IGCM_debug_Exit "ncra" 
     2371    echo "IGCM_sys_ncra : ncra error" 
     2372    IGCM_debug_Exit "ncra" 
    21132373  fi 
    21142374 
     
    21162376} 
    21172377 
     2378#D-#================================================== 
     2379#D-function IGCM_sys_ncrcat 
     2380#D-* Purpose: encapsulate ncrcat call so as to manage error code and retry 
     2381#D-* Examples: 
     2382#D- 
    21182383function IGCM_sys_ncrcat { 
    21192384  IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 
     
    21222387  fi 
    21232388 
    2124   typeset NB_ESSAI DELAI status i 
     2389  typeset NB_ESSAI DELAI status i lastArg 
    21252390  # number of tentative 
    21262391  NB_ESSAI=3 
     
    21382403      IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    21392404      sleep $DELAI 
     2405    elif [ ! "X$( grep "WARNING Intra-file non-monotonicity" out_rsync )" = "X" ] ; then 
     2406      IGCM_debug_Print 2 "IGCM_sys_ncrcat : WARNING Intra-file non-monotonicity" 
     2407      cat out_rsync 
     2408      # remove files having corrupted time axis 
     2409      eval lastArg=\${$#} 
     2410      IGCM_debug_Print 2 "IGCM_sys_ncrcat : Delete ${lastArg}" 
     2411      \rm ${lastArg} 
     2412      \rm out_rsync 
     2413      IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
     2414      sleep $DELAI 
    21402415    else 
    21412416      \rm out_rsync 
     
    21462421 
    21472422  if [ ${status} -gt 0 ] ; then 
    2148       echo "IGCM_sys_ncrcat : ncrcat error" 
    2149       #IGCM_debug_Exit "ncrcat" 
     2423    echo "IGCM_sys_ncrcat : ncrcat error" 
     2424    #IGCM_debug_Exit "ncrcat" 
    21502425  fi 
    21512426 
     
    21532428} 
    21542429 
     2430#D-#================================================== 
     2431#D-function IGCM_sys_ncrename 
     2432#D-* Purpose: encapsulate ncrename call so as to manage error code and retry 
     2433#D-* Examples: 
     2434#D- 
    21552435function IGCM_sys_ncrename { 
    21562436  IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 
     
    21832463 
    21842464  if [ ${status} -gt 0 ] ; then 
    2185       echo "IGCM_sys_ncrename : ncrename error" 
    2186       IGCM_debug_Exit "ncrename" 
     2465    echo "IGCM_sys_ncrename : ncrename error" 
     2466    IGCM_debug_Exit "ncrename" 
    21872467  fi 
    21882468 
     
    21902470} 
    21912471 
     2472#D-#================================================== 
     2473#D-function IGCM_sys_ncwa 
     2474#D-* Purpose: encapsulate ncwa call so as to manage error code and retry 
     2475#D-* Examples: 
     2476#D- 
    21922477function IGCM_sys_ncwa { 
    21932478  IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 
     
    22202505 
    22212506  if [ ${status} -gt 0 ] ; then 
    2222       echo "IGCM_sys_ncwa : ncwa error" 
    2223       IGCM_debug_Exit "ncwa" 
     2507    echo "IGCM_sys_ncwa : ncwa error" 
     2508    IGCM_debug_Exit "ncwa" 
    22242509  fi 
    22252510 
     
    22302515# CDO OPERATOR 
    22312516 
     2517#D-#================================================== 
     2518#D-function IGCM_sys_cdo 
     2519#D-* Purpose: encapsulate cdo call so as to manage error code and retry 
     2520#D-* Examples: 
     2521#D- 
    22322522function IGCM_sys_cdo { 
    22332523  IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 
Note: See TracChangeset for help on using the changeset viewer.