Changeset 1150 for trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh
- Timestamp:
- 01/13/15 19:20:09 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh
r1140 r1150 131 131 b64_encoded_msg=$1 132 132 133 # R_TMP point to RUN_DIR_PATH on Ada and on /tmp otherwise134 buffer=${R_TMP}/buffer.$$135 133 mail_recipient="superviseur@ipsl.jussieu.fr" 136 134 send_messages=0 137 135 mail_frequency=3600 # in seconds 138 136 # use to keep track when was last mail sent (maybe to be replaced with global variable) 139 last_mail_date__file=${R_TMP}/stamp.$$ 137 last_mail_date__file=${R_BUF}/.stamp.${config_UserChoices_TagName}.${config_UserChoices_JobName} 138 # use to accumulate messages before sending them 139 buffer=${R_BUF}/.buffer.${config_UserChoices_TagName}.${config_UserChoices_JobName} 140 140 141 141 # init 142 142 if [ ! -f "${buffer}" ]; then 143 touch "${buffer}" 144 fi 145 146 # retrieve pending messages number 147 messages_count=$( wc -l ${buffer} | gawk {'print $1'} ) 143 touch ${buffer} 144 fi 148 145 149 146 if [ ! -f "${last_mail_date__file}" ]; then 150 # if we are here, it means no mail has been sent yet 151 # send the first mail 152 [ ${messages_count} -gt 0 ] && send_messages=1 147 touch ${last_mail_date__file} 153 148 else 154 149 # compute last time the file was changed (in seconds) 155 150 seconds_since_last_mail=$(( $(date +%s) - $(stat -c %Y ${last_mail_date__file}) )) 156 151 # send message when exceeding threshold … … 169 164 touch ${last_mail_date__file} # memorize last mail date 170 165 initBigBro=false 171 elif ( [ ${send_messages} -eq 1 ] || [ X${FlushAMQP} = XTRUE ] ); then166 elif [ ${send_messages} -eq 1 ] ; then 172 167 #echo $(date +"%Y-%m-%dT%H:%M:%S.%N%z") >> ${SUBMIT_DIR}/mail.txt 173 168 mailx -s "[TEMPORARY AMQP CHANNEL]" ${mail_recipient} < ${buffer} # send buffer 174 rm -f $ buffer ; touch ${buffer} # clearbuffer169 rm -f ${buffer} ; touch ${buffer} # flush the buffer 175 170 touch ${last_mail_date__file} # memorize last mail date 171 fi 172 173 if [ X${FlushAMQP} = XTRUE ] ; then 174 mailx -s "[TEMPORARY AMQP CHANNEL]" ${mail_recipient} < ${buffer} # send buffer 175 rm -f ${buffer} # cleaning behind us 176 rm -f ${last_mail_date__file} # cleaning behind us 176 177 fi 177 178 … … 297 298 fi 298 299 299 if [ X${ActivateBigBro} = Xtrue ] ; then 300 # RabbitMQ message code "PUSHSTACK" 301 code=2000 302 # RabbitMQ message body 303 Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${IGCM_debug_Stack[0]}\",\"arguments\":[\"${IGCM_debug_StackArgs[0]}\"],\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) 304 # Fill the rabbitMQ queue 305 IGCM_debug_sendAMQP 306 fi 300 # Unplugged message 2000 handling for now. To ease downstream treatment. 301 #if [ X${ActivateBigBro} = Xtrue ] ; then 302 # # RabbitMQ message code "PUSHSTACK" 303 # code=2000 304 # # RabbitMQ message body 305 # Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${IGCM_debug_Stack[0]}\",\"arguments\":[\"${IGCM_debug_StackArgs[0]}\"],\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) 306 # # Fill the rabbitMQ queue 307 # IGCM_debug_sendAMQP 308 #fi 307 309 308 310 # Increment LenStack … … 513 515 fi 514 516 515 if [ X${ActivateBigBro} = Xtrue ] ; then 516 # RabbitMQ message code "POPSTACK" 517 code=3000 518 # RabbitMQ message body 519 Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${command}\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) 520 # Fill the rabbitMQ queue 521 IGCM_debug_sendAMQP 522 fi 517 # Unplugged message 3000 handling for now. To ease downstream treatment. 518 #if [ X${ActivateBigBro} = Xtrue ] ; then 519 # # RabbitMQ message code "POPSTACK" 520 # code=3000 521 # # RabbitMQ message body 522 # Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${command}\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) 523 # # Fill the rabbitMQ queue 524 # IGCM_debug_sendAMQP 525 #fi 523 526 fi 524 527
Note: See TracChangeset
for help on using the changeset viewer.