#!/bin/sh # # mysql_tc208_query.sh $TABLE $SEC_AGO # # $TABLE - the table to use, ie tc208 # $SEC_AGO - query from NOW to NOW-SEC_AGO # # queries the spex temperature database for data, ie # mysql_tc208_query.sh tc208 7200 - query for the last 2 hrs day # mysql_tc208_query.sh tc208 86400 - query data for the last day # mysql_tc208_query.sh tc208 604800 - query data for the week. # if [ $# -ne 2 ] then echo " usage: $0 table sec_ago " exit 1 fi # dbname=spex table=${1} sec_ago=${2} # # -s to suppress column name and table format. mysql -s --host=irtfweb.ifa.hawaii.edu --user=spex --password='XXXXX' < (UNIX_TIMESTAMP() - $sec_ago) ORDER BY tv_sec DESC; \q STOP