#! /bin/bash # # Script that starts up bash script based on amqpfind messages # # Note - when using Full Disk make sure -n is set to 7. Otherwise, `Disk' will be passed to the next call to the script. set -e source /etc/profile module load gcc/6.1 module load hdf/4.2.12-nocdf module load hdf5/1.8.17 module load netcdf3/3.6.3 module load netcdf4/4.4.1 module load miniconda/3.19-base #module load miniconda/3.6-base module list export COVERAGE=FLDK export PATH=$PWD:$PATH ##This routine will send a notification email 1/hour if the messages time out #send_failure_mail() { # # #### allow only one email per hour # # tag="$(date '+%Y%m%dT%H')" # # # # if [[ "$tag" != "$old_tag" ]] # # then # # date | mail -s "GRB timeout" kbah@ssec.wisc.edu # # echo "Hiawari timeout email" # # old_tag=$tag # # fi ##} # # ### allow only one email per 2-hour # tag0="$(date '+%H')" # tag1="(($(date '+%H') +1 ))" # # if [[ "$tag1" != "$old_tag" ]] # then # date | mail -s "GRB timeout" kbah@ssec.wisc.edu # echo "Hiawari timeout email sent at:" $(date) # old_tag=$tag1 # fi #} # use a marker file instead of a global variable # marker file is first parameter # period is second parameter: 3h, 4h, 1d, see find command manpage send_failure_mail_touchnfind() { marker="$1" delta="$2" marker_dir="$(dirname $marker)" test -z "$marker_dir" && marker_dir=. marker_fn="$(basename $marker)" # look for a marker that's younger than ${delta}; if none exists, send mail and touch marker if [ -z "$(find $marker_dir -name $marker_fn -mtime -${delta} -maxdepth 1)" ]; then date |mail -s "AHI timeout" ${USER}@ssec.wisc.edu touch $marker fi } echo START OF AHI LOOP $HOME/amqpfind/amqpfind -w 7200 -k '(datetime,coverage)' -H mq2.ssec.wisc.edu -p sdsmq -u sdsuser \ -H mq1.ssec.wisc.edu -p sdsmq -u sdsuser \ -X satellite \ -t 0 \ -C geo.himawari.8.ahi.file.satbuf.hsf.image.complete \ -j '{coverage} {datetime} {path} {sat_family} {sat_identifier}'|grep --line-buffered -i ${COVERAGE} | xargs -n6 ${PWD}/callCLAVR.bash #$HOME/amqpfind/amqpfind -H mq1.ssec.wisc.edu -p sdsmq -u sdsuser \ #-H mq2.ssec.wisc.edu -p sdsmq -u sdsuser \ #-k '(datetime)' \ #-w 30.0 \ #-X satellite \ #-j '{coverage} {datetime} {path} {sat_family} {sat_identifier}' \ #-C geo.himawari.*.*.*.arcdata.*.*.complete |grep --line-buffered -i ${COVERAGE} | xargs -n6 ${PWD}/callCLAVR.bash ###-C geo.himawari.*.*.*.*.*.image.complete |grep --line-buffered -i ${COVERAGE} | xargs -n6 ${PWD}/callCLAVR.bash echo END OF LOOP # /home/clavrx_ops/amqpfind/amqpfind -H mq2.ssec.wisc.edu -p sdsmq -u sdsuser -H mq1.ssec.wisc.edu -p sdsmq -u sdsuser -X satellit -j '{coverage} #{datetime} {path} {sat_family} {sat_identifier}' -C geo.himawari.*.*.*.*.*.*.* |grep --line-buffered -i ${COVERAGE} | xargs -n6 ${PWD}/callCLAVR.bash