#!/usr/bin/ksh # # This script writes lists usgs ascii files to database. It is intended to be used when for some # reason the automatic daily write of file names to the database has failed. # ## Set the environment variables # if [[ -z $THMSOC ]] then THMSOC=/disks/socware/thmsoc_dp_current export THMSOC fi . $THMSOC/src/config/soc_it_to_me.config #. $THMSOC/src/config/gbo_atha_rmd_mirror.config for year in 2007 2008 2009 2010 2011 2012 do for site in bou brw bsl cmo ded frd frn gua hon new shu sit sjg tuc do if [[ $os = "SunOS" ]] then ucsite=$(echo $site | nawk '{print toupper($1)}') else ucsite=$(echo $site | awk '{print toupper($1)}') fi while read date do fileName=thg_l2_mag_${site}_${date}_v01.cdf year=$(echo $date | awk -F_ '{print substr($1,1,4)}') month=$(echo $date | awk -F_ '{print substr($1,5,2)}') day=$(echo $date | awk -F_ '{print substr($1,7,2)}') dataTime="${year}-${month}-${day} 00:00:00" mysql_table_name=gbo_${ucsite}_cdffiles fileSize=$(ls -l /disks/themisdata/thg/l2/mag/${site}/${year}/$fileName |awk '{print $5}') processTime=$(date -u '+%Y-%m-%d %T') processCode="HardDrive" echo "$mysql_table_name $dataTime $fileName $processTime $fileSize" ${PHP_SCRIPTS}/gmag_cdf.php $mysql_table_name $dataTime $fileName $processTime $fileSize done < /home/thmsoc/clrussells_stuff/filelists/gmag_cdf_list_${site}_${year}.txt rm -rf /home/thmsoc/clrussells_stuff/filelists/gmag_cdf_list_${site}_${year}.txt done done exit 0