#!/bin/sh # # mysql_query.sh $TABLE $SEC_AGO $ID # # $TABLE - the table to use, ie Data # $SEC_AGO - query from NOW to NOW-SEC_AGO # $ID - sub string IDing data that is group together. # # queries the spex temperature database for data, ie # mysql_query.sh Data 7200 bg_ - query for bigdog tc data for the last 2 hrs. # mysql_query.sh Data 86400 gd_ - query for guidedog tc data for the 24 hrs. # mysql_query.sh Data 604800 spex_ch - query for spex 218 data for 1 week. # if [ $# -ne 3 ] then echo " usage: $0 table sec_ago id_prefix " exit 1 fi # dbname=spex table=${1} sec_ago=${2} ids=${3}"%" # # -s to suppress column name and table format. mysql -s --host=irtfweb.ifa.hawaii.edu --user=spex --password='XXXX' < (UNIX_TIMESTAMP() - $sec_ago) AND SensorID LIKE '$ids' GROUP BY Timestamp; \q STOP