#!/bin/bash
rm -f /tmp/date.txt
mysql -uroot -paike100*  -e  "select created_at from qianqu.discovers order by created_at desc limit 1 into outfile '/tmp/date.txt'"
date1=`cat /tmp/date.txt`
date2=`date +"%Y-%m-%d %H:%M:%S"`
dbtime=`date -d "$date1" +%s`
systime=`date -d "$date2" +%s`
time=`expr $systime - $dbtime`
if [ $time -gt 7200 ]; then
echo -e "Interval:$timeS \n" "dbtime=$date1 \n"  "servertime=$date2" |mail -s "qiandberror_$date2" [email protected] [email protected]
fi