#!/usr/bin/ksh # MODIFIED FROM: (set the site name further down in the file) # 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 line in $(cat ${UCLA_MIRROR_HOME}/site_list.txt) #do line=princegeorge_pgeo site=$(echo $line | awk -F_ '{print $1}') site_abbr=$(echo $line | awk -F_ '{print $2}') ucsite=$(echo $site_abbr |${awk} '{print toupper(substr($1,1,4))}') mysql_table_name=epo_${ucsite}_rmdfiles rm -f /tmp/gmag_raw_epo_hourly_${site_abbr}.txt grep $filepart /home/thmsoc/lphilpotts_stuff/gmag_raw_epo_hourly_${site_abbr}.txt > /tmp/gmag_raw_epo_hourly_${site_abbr}.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 ${UCLA_MIRROR_HOME}/${site}/${year}/${month}/${day}/$fileName |awk '{print $5}') /home/thmsoc/software_dev/php/epo_ucla_rmd_mirror.php $mysql_table_name $dataTime $fileName $processTime $processCode $fileSize done < /tmp/gmag_raw_epo_hourly_${site_abbr}.txt #done exit 0