#!/bin/bash export MYSQL_PWD=epg if [ "$1" == "-h" ]; then echo " Usage: $0 [] []" echo " (without channelid the merge state will shown)" echo "" echo " Example: $0 S19.2E-1-1010-11150 \"2013-10-01 16:00\"" exit 0 fi mysql -u epg2vdr -Depg2vdr -e "select from_unixtime(lastmerge) as 'last merge was at' from vdrs where uuid = 'epgd';" mysql -u epg2vdr -Depg2vdr -e "select count(1) as 'events pending for merge' from events where source = 'vdr' and updsp > (select lastmerge from vdrs where uuid = 'epgd');" mysql -u epg2vdr -Depg2vdr -e "select count(source),source from events group by source;" if [ -z "$1" ]; then mysql -u epg2vdr -Depg2vdr -e "select count(*),source,updflg from events where starttime+duration >= unix_timestamp() group by source,updflg;" else if [ -z "$2" ]; then to=`date +%Y-%m-%d -d "+ 1 day"` else to=$2 fi echo "channel $1" mysql -u epg2vdr -Depg2vdr -e "select source,masterid,useid,updflg,delflg,from_unixtime(starttime) starttime,round(duration/60,0) duration,substr(title,1,45) title,from_unixtime(updsp) updsp from events where channelid = '$1' and starttime+duration >= unix_timestamp() order by starttime,source desc limit 50;" fi