#!/usr/bin/ksh # # epo_jpg_check.ksh - check for transferred and combined # jpg files. Alert staff if data is missing. # ## Set the environment variables # if [[ -z $THMSOC ]] then THMSOC=/disks/socware/thmsoc_dp_current export THMSOC fi . $THMSOC/src/config/thmsoc_epo.config #. $HOME/software_dev/config/thmsoc_epo.config ## Move to the directory containg the EPO data # cd $EPO_HOME ## Check for lock file # if [[ -a /home/thmsoc/lphilpotts_stuff/tmp/epo_jpg_check_lock ]] ; then exit 0 fi echo $$ > /home/thmsoc/lphilpotts_stuff/tmp/epo_jpg_check_lock ## Function Definitionsfind # ## Set a counter (n) and then set a variable to the ## first school name in the SCHOOL array which was ## defined in the config file above # n=0 school=${SCHOOL[$n]} # Now lets start looping through the schools # while [[ -n $school ]] do school_dir=$(echo $school | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/') chkStatus="" ############################################## ## Search for x, y, and z time series plots ## ############################################## # find ./${school_dir} -name ${school}_TS1_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/ts1_file_check find ./${school_dir} -name ${school}_TS2_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/ts2_file_check find ./${school_dir} -name ${school}_TS3_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/ts3_file_check find ./${school_dir} -name ${school}_TS123_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/ts123_file_check xyzTSstatus="OK" if [[ ! -s /home/thmsoc/lphilpotts_stuff/tmp/ts1_file_check || ! -s /home/thmsoc/lphilpotts_stuff/tmp/ts2_file_check || ! -s /home/thmsoc/lphilpotts_stuff/tmp/ts3_file_check || ! -s /home/thmsoc/lphilpotts_stuff/tmp/ts123_file_check ]] then xyzTSstatus=Check chkStatus=Check fi rm -f /home/thmsoc/lphilpotts_stuff/tmp/ts* ############################################## ## Search for B, D, and H time series plots ## ############################################## # find ./${school_dir} -name ${school}_TSB_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/tsb_file_check find ./${school_dir} -name ${school}_TSD_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/tsd_file_check find ./${school_dir} -name ${school}_TSH_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/tsh_file_check find ./${school_dir} -name ${school}_TSBDH_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/tsbdh_file_check bdhTSstatus="OK" if [[ ! -s /home/thmsoc/lphilpotts_stuff/tmp/tsb_file_check || ! -s /home/thmsoc/lphilpotts_stuff/tmp/tsd_file_check || ! -s /home/thmsoc/lphilpotts_stuff/tmp/tsh_file_check || ! -s /home/thmsoc/lphilpotts_stuff/tmp/tsbdh_file_check ]] then bdhTSstatus=Check chkStatus=Check fi rm -f /home/thmsoc/lphilpotts_stuff/tmp/ts* ############################################# ## Search for x, y, and z day series plots ## ############################################# # find ./${school_dir} -name ${school}_DS1_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/ds1_file_check find ./${school_dir} -name ${school}_DS2_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/ds2_file_check find ./${school_dir} -name ${school}_DS3_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/ds3_file_check find ./${school_dir} -name ${school}_DS123_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/ds123_file_check xyzDSstatus="OK" if [[ ! -s /home/thmsoc/lphilpotts_stuff/tmp/ds1_file_check || ! -s /home/thmsoc/lphilpotts_stuff/tmp/ds2_file_check || ! -s /home/thmsoc/lphilpotts_stuff/tmp/ds3_file_check || ! -s /home/thmsoc/lphilpotts_stuff/tmp/ds123_file_check ]] then xyzDSstatus=Check chkStatus=Check fi rm -f /home/thmsoc/lphilpotts_stuff/tmp/ds* ############################################# ## Search for B, D, and H day series plots ## ############################################# # find ./${school_dir} -name ${school}_DSB_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/dsb_file_check find ./${school_dir} -name ${school}_DSD_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/dsd_file_check find ./${school_dir} -name ${school}_DSH_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/dsh_file_check find ./${school_dir} -name ${school}_DSBDH_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/dsbdh_file_check bdhDSstatus="OK" if [[ ! -s /home/thmsoc/lphilpotts_stuff/tmp/dsb_file_check || ! -s /home/thmsoc/lphilpotts_stuff/tmp/dsd_file_check || ! -s /home/thmsoc/lphilpotts_stuff/tmp/dsh_file_check || ! -s /home/thmsoc/lphilpotts_stuff/tmp/dsbdh_file_check ]] then bdhDSstatus=Check chkStatus=Check fi rm -f /home/thmsoc/lphilpotts_stuff/tmp/ds* #################################### ## Search for Time Series Spectra ## #################################### # find ./${school_dir} -name ${school}_TSpectra_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/tspec_file_check specTSstatus="OK" if [[ ! -s /home/thmsoc/lphilpotts_stuff/tmp/tspec_file_check ]] then specTSstatus=Check chkStatus=Check fi rm /home/thmsoc/lphilpotts_stuff/tmp/tspec_file_check #################################### ## Search for Day Series Spectra ## #################################### # find ./${school_dir} -name ${school}_DSpectra_\* -mtime ${CHECK_MTIME} > /home/thmsoc/lphilpotts_stuff/tmp/dspec_file_check specDSstatus="OK" if [[ ! -s /home/thmsoc/lphilpotts_stuff/tmp/dspec_file_check ]] then specDSstatus=Check chkStatus=Check fi rm /home/thmsoc/lphilpotts_stuff/tmp/dspec_file_check ############################## ## Now report on file check ## ############################## my_email="lphilpott@igpp.ucla.edu" if [[ -n $chkStatus ]] then printf "%s\n%s\n" "THEMIS EPO-GMAG JPG Processing Warning" \ "Files not received for $CHECK_MTIME days. " \ "Check the following:" \ "School = $school" \ "xyzTSstatus = $xyzTSstatus" \ "bdhTSstatus = $bdhTSstatus" \ "xyzDSstatus = $xyzDSstatus" \ "bdhDSstatus = $bdhDSstatus" \ "specTSstatus = $specTSstatus" \ "specDSstatus = $specDSstatus" | mail -s "THEMIS EPO-GMAG JPG Processing TEST" $my_email fi n=$(( n + 1 )) school=${SCHOOL[$n]} done # ## Cleanup # rm -f /home/thmsoc/lphilpotts_stuff/tmp/epo_jpg_check_lock exit 0