summaryrefslogtreecommitdiffstats
path: root/abs/core/zoneminder/zmeventbackup
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2011-10-19 18:31:38 (GMT)
committerJames Meyer <james.meyer@operamail.com>2011-10-19 18:31:38 (GMT)
commitd9aad8b00a9f3fb60e456c0e528df90189acb5b3 (patch)
tree6b9126d2336c62d1e5533798e7348f6a5723f6ba /abs/core/zoneminder/zmeventbackup
parentd9a08ac22f9c6661cf3b478927be321274d10794 (diff)
parentc65b741914b31ac88086e363edc4415eb6aa1686 (diff)
downloadlinhes_pkgbuild-d9aad8b00a9f3fb60e456c0e528df90189acb5b3.zip
linhes_pkgbuild-d9aad8b00a9f3fb60e456c0e528df90189acb5b3.tar.gz
linhes_pkgbuild-d9aad8b00a9f3fb60e456c0e528df90189acb5b3.tar.bz2
Merge remote-tracking branch 'origin/testing' into testing
Conflicts: abs/core/LinHES-config/PKGBUILD
Diffstat (limited to 'abs/core/zoneminder/zmeventbackup')
-rwxr-xr-xabs/core/zoneminder/zmeventbackup48
1 files changed, 48 insertions, 0 deletions
diff --git a/abs/core/zoneminder/zmeventbackup b/abs/core/zoneminder/zmeventbackup
new file mode 100755
index 0000000..71c9538
--- /dev/null
+++ b/abs/core/zoneminder/zmeventbackup
@@ -0,0 +1,48 @@
+#!/bin/bash
+#===============================================================================
+#
+# FILE: eventdump.sh
+#
+# USAGE: ./eventdump.sh
+#
+# DESCRIPTION: Uses mysqldump to create a .sql file for individual zm
+# events to make Event table recovery possible by doing a
+# 'find' search in ZoneMinder the events directory
+#
+# OPTIONS: ---
+# REQUIREMENTS: --- mysqldump
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Ross Melin <rdmelin@gmail.com>
+# COMPANY:
+# VERSION: 1.0
+# CREATED: 03/06/2008 11:51:19 AM PST
+# REVISION: ---
+#===============================================================================
+
+# Edit these to suit your configuration
+ZM_CONFIG=/etc/zm.conf
+MYSQLDUMP=/usr/bin/mysqldump
+EVENTSDIR=/var/lib/zm/www/events
+
+# The rest should not need editing
+
+# Get the mysql user and password
+source $ZM_CONFIG
+MYDUMPOPTS="--user=$ZM_DB_USER --password=$ZM_DB_PASS --skip-opt --compact --quick --no-create-info"
+
+
+for tag in $(find $EVENTSDIR -amin -65 -name ".[0-9]*")
+ do
+ EVENT_PATH=$(echo $tag |cut -f 1 -d .)
+ EVENT_ID=$(echo $tag |cut -f 2 -d .)
+ # Dump the sql statements needed to reload the Events, Frames and Stats tables
+
+ echo "-- ZM_DB_VERSION=$ZM_VERSION
+" > $EVENT_PATH.sql
+
+ $MYSQLDUMP $MYDUMPOPTS --where="Id=$EVENT_ID" zm Events >> $EVENT_PATH.sql
+ $MYSQLDUMP $MYDUMPOPTS --where="Eventid=$EVENT_ID" zm Frames >> $EVENT_PATH.sql
+ $MYSQLDUMP $MYDUMPOPTS --where="Eventid=$EVENT_ID" zm Stats >> $EVENT_PATH.sql
+
+done