Changeset 1234 for trunk/libIGCM


Ignore:
Timestamp:
09/03/15 17:12:53 (9 years ago)
Author:
sdipsl
Message:
  • catch the status of the stat command. It led to silent failure when the filesystem suffers some glitch. See #264
Location:
trunk/libIGCM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh

    r1231 r1234  
    128128  typeset buffer send_messages mail_frequency 
    129129  typeset last_mail_date__file 
     130  typeset secondsBetweenRefAndLastMail secondsSinceLastMail 
    130131 
    131132  b64_encoded_msg=$1 
     
    148149  else 
    149150    # compute last time the file was changed (in seconds) 
    150     seconds_since_last_mail=$(( $(date +%s) - $(stat -c %Y ${last_mail_date__file}) )) 
     151    secondsBetweenRefAndLastMail=$(stat -c %Y ${last_mail_date__file}) 
     152    status=$? 
     153    # 
     154    if [ ${status} -gt 0 ] ; then 
     155      IGCM_debug_Exit "IGCM_debug_send_AMQP_msg__MAILTUNNEL" 
     156    fi 
     157    secondsSinceLastMail=$(( $(date +%s) - ${secondsBetweenRefAndLastMail} )) 
    151158    # send message when exceeding threshold 
    152     [ ${seconds_since_last_mail} -gt ${mail_frequency} ] && send_messages=1 
     159    [ ${secondsSinceLastMail} -gt ${mail_frequency} ] && send_messages=1 
    153160  fi 
    154161 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys.ksh

    r1204 r1234  
    700700 
    701701  typeset NB_ESSAI DELAI status i exist skip 
     702  typeset fileDeviceNumberInHex directoryDeviceNumberInHex 
    702703 
    703704  # number of tentative 
     
    738739      i=0 
    739740      while [ $i -lt $NB_ESSAI ] ; do 
    740         if [ $( stat -c %d $1 ) -ne $( stat -c %d $( dirname $2 ) ) ] ; then 
    741           # USUAL WAY 
     741        # Identify file system 
     742        fileDeviceNumberInHex=$( stat -c %d $1 ) 
     743        status=$? 
     744        if [ ${status} -gt 0 ] ; then 
     745          IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 
     746        fi 
     747        # Identify file system 
     748        directoryDeviceNumberInHex=$( stat -c %d $( dirname $2 ) ) 
     749        status=$? 
     750        if [ ${status} -gt 0 ] ; then 
     751          IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 
     752        fi 
     753 
     754        if [ ${fileDeviceNumberInHex} -ne ${directoryDeviceNumberInHex} ] ; then 
     755          # They are not on the same device. USUAL WAY 
    742756          \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    743757          status=$? 
    744758        else 
    745           # NOT SO USUAL WAY 
     759          # They are on the same device. USUAL WAY 
    746760          \mv $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    747761          status=$? 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh

    r1230 r1234  
    636636 
    637637  typeset NB_ESSAI DELAI status i exist skip 
     638  typeset fileDeviceNumberInHex directoryDeviceNumberInHex 
    638639 
    639640  # number of tentative 
     
    673674      i=0 
    674675      while [ $i -lt $NB_ESSAI ] ; do 
    675         if [ $( stat -c %d $1 ) -ne $( stat -c %d $( dirname $2 ) ) ] ; then 
    676           # USUAL WAY 
     676        # Identify file system 
     677        fileDeviceNumberInHex=$( stat -c %d $1 ) 
     678        status=$? 
     679        if [ ${status} -gt 0 ] ; then 
     680          IGCM_debug_Exit "IGCM_sys_Put_Out" 
     681        fi 
     682        # Identify file system 
     683        directoryDeviceNumberInHex=$( stat -c %d $( dirname $2 ) ) 
     684        status=$? 
     685        if [ ${status} -gt 0 ] ; then 
     686          IGCM_debug_Exit "IGCM_sys_Put_Out" 
     687        fi 
     688 
     689        if [ ${fileDeviceNumberInHex} -ne ${directoryDeviceNumberInHex} ] ; then 
     690          # They are not on the same device. USUAL WAY 
    677691          \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    678692          status=$? 
    679693        else 
    680           # NOT SO USUAL WAY 
     694          # They are on the same device. NOT SO USUAL WAY 
    681695          \mv $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    682696          status=$? 
Note: See TracChangeset for help on using the changeset viewer.