#!/usr/bin/ksh # # This script writes lists of GIMA cdf 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/gima_netcdf2all.config while read line do school=$(echo $line | awk -F_ '{print $1}') if [[ $os = "SunOS" ]] then ucsite=$(echo $school | nawk '{print toupper($1)}') else ucsite=$(echo $school | awk '{print toupper($1)}') fi while read path do fileName=${path##*/} cdffile=$fileName txtfile=${fileName%.*}.txt processTime=$(date -u '+%Y-%m-%d %T') year=$(echo $fileName | awk -F_ '{print substr($5,1,4)}') month=$(echo $cdffile | awk -F_ '{print substr($5,5,2)}') day=$(echo $cdffile | awk -F_ '{print substr($5,7,2)}') cdf_archive_dir=${L2MAGDIR}/${school}/${year} ascii_archive_dir=${ASCIIMAGDIR}/${school}/${year} dataTime=$(echo $year $month $day | awk '{printf("%s-%02s-%02s 00:00:00",$1,$2,$3)}') mysql_cdftable_name=gbo_${ucsite}_cdffiles mysql_asciitable_name=gbo_${ucsite}_asciifiles cdffileSize=$(ls -l ${cdf_archive_dir}/${cdffile} |awk '{print $5}') txtfileSize=$(ls -l ${ascii_archive_dir}/${txtfile} |awk '{print $5}') echo "$mysql_cdftable_name $dataTime $cdffile $processTime $cdffileSize" echo "$mysql_asciitable_name $dataTime $txtfile $processTime $txtfileSize" gmag_cdf.php $mysql_cdftable_name $dataTime $cdffile $processTime $cdffileSize gmag_ascii.php $mysql_asciitable_name $dataTime $txtfile $processTime $txtfileSize done < /home/thmsoc/lphilpotts_stuff/filelists/${school}_cdf_files done < ${CONFIGDIR}/gima_network.txt exit 0