#!/usr/bin/ksh # # This script writes lists of Alaska netcdf 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_ualaska_mirror.config while read line do school=$(echo $line | awk -F_ '{print $2}') while read path do fileName=${path##*/} year=$(echo $fileName | awk -F. '{print substr($1,1,4)}') gboName=$(echo $fileName |sed 's/[0-9][0-9]*//'|sed 's/[0-9][0-9]*//'|awk -F- '{print $1}') sedTemp=$(echo $fileName |sed 's/[[A-Za-z][A-Za-z]*//') doy=$(echo $sedTemp |awk -F. '{print substr($1,5,3)}') hr=$(echo $sedTemp |awk -F. '{print substr($1,9,2)}') date=$(doy2date $year $doy) month=$(echo $date |awk -F/ '{print $2}') day=$(echo $date |awk -F/ '{print $3}') dataTime=$(echo $year $month $day $hr | awk '{printf("%s-%02s-%02s %02s:00:00",$1,$2,$3,$4)}') mysql_table_name=gbo_${gboName}_magfiles fileSize=$(ls -l ${UCB_MIRROR_HOME}/${school}/${year}/$fileName |awk '{print $5}') processTime=$(date -u '+%Y-%m-%d %T') processCode="HardDrive" echo "$mysql_table_name $dataTime $fileName $processTime $processCode $fileSize" ${PHP_SCRIPTS}/gbo_ualaska_mirror.php $mysql_table_name \ $dataTime $fileName $processTime $processCode $fileSize done < /home/thmsoc/lphilpotts_stuff/filelists/${school}_netcdf_files done < ${CONFIGDIR}/gima_network.txt exit 0