#!/usr/bin/ksh # script to write athabasca site rmd file info to the database # MODIFIED FROM: # epo_ucla_rmd_table_update.ksh - Sometimes the RMDs # collected don't make it to the database. This script tries # to keep them in sync. # # $1 = year # $2 = month # # Creation Date: # # 22 march 2006 TimQuinn # # ## Set the environment variables # # . $HOME/software_dev/config/ground_mag.config # . $HOME/software_dev/config/soc_it_to_me.config if [[ -z $THMSOC ]] then THMSOC=/disks/socware/thmsoc_dp_current export THMSOC fi . $THMSOC/src/config/ground_mag.config . $THMSOC/src/config/soc_it_to_me.config year=$1 shortyear=$(echo $year | awk '{print substr($1,3,2)}') month=$(echo $2 | awk '{printf ("%02s",$1)}') filepart=${shortyear}${month} processTime=$(date -u '+%Y-%m-%d %T') processCode="HardDrive" ## Determine which awk to use # if [[ $os = "SunOS" ]] then awk=nawk else awk=awk fi for ucsite in LARG LETH REDR ROTH do mysql_table_name=gbo_${ucsite}_rmdfiles rm -f /tmp/gmag_raw_ath_hourly_${ucsite}.txt grep $filepart /home/thmsoc/lphilpotts_stuff/gmag_raw_ath_hourly_${ucsite}.txt > /tmp/gmag_raw_ath_hourly_${ucsite}.txt while read fileName do year=$(echo $fileName |awk -F_ '{print "20"substr($1,5,2)}') month=$(echo $fileName |awk -F_ '{print substr($1,7,2)}') day=$(echo $fileName |awk -F_ '{print substr($1,9,2)}') dataTime=$(echo $fileName |awk -F_ '{print "20"substr($1,5,2)"-"substr($1,7,2)"-"substr($1,9,2)" "$3":00:00"}') fileSize=$(ls -l /disks/themisdata/thg/mirrors/mag/uatha_rmd/${ucsite}/${year}/${month}/${day}/$fileName |awk '{print $5}') /disks/socware/thmsoc_dp_current/src/php/gbo_uatha_rmd_mirror.php $mysql_table_name $dataTime $fileName $processTime $processCode $fileSize done < /tmp/gmag_raw_ath_hourly_${ucsite}.txt done exit 0