summaryrefslogtreecommitdiffstats
path: root/abs/core/zoneminder/zmeventbackup
diff options
context:
space:
mode:
authorMichael Hanson <mihanson@linhes.org>2011-10-08 00:48:25 (GMT)
committerMichael Hanson <mihanson@linhes.org>2011-10-08 00:48:25 (GMT)
commitee019be570e80f20f106a6b0b739be427c5f89bc (patch)
tree47c56548770be52fc9a600f28eb4935844820f5b /abs/core/zoneminder/zmeventbackup
parentf37574bd879953f9c2c1ee1dc97577d804759895 (diff)
parent04949a18e6ea4a313d101911dcdc689d029ddcb1 (diff)
downloadlinhes_pkgbuild-ee019be570e80f20f106a6b0b739be427c5f89bc.zip
linhes_pkgbuild-ee019be570e80f20f106a6b0b739be427c5f89bc.tar.gz
linhes_pkgbuild-ee019be570e80f20f106a6b0b739be427c5f89bc.tar.bz2
Merge branch 'testing' of knoppmyth.net:linhes_pkgbuild into testing
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