summaryrefslogtreecommitdiff
path: root/scripts/epgd-showmerge
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/epgd-showmerge')
-rwxr-xr-xscripts/epgd-showmerge32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/epgd-showmerge b/scripts/epgd-showmerge
new file mode 100755
index 0000000..1dc022a
--- /dev/null
+++ b/scripts/epgd-showmerge
@@ -0,0 +1,32 @@
+export MYSQL_PWD=epg
+
+if [ "$1" == "-h" ]; then
+
+ echo " Usage: $0 [<channelid>] [<to-date>]"
+ 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 'las 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