diff options
author | André Fabian Silva Delgado <emulatorman@lavabit.com> | 2012-09-11 03:36:56 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@lavabit.com> | 2012-09-11 03:36:56 -0300 |
commit | 1187d7cb38d2700e4773d79b1a3d26fd46adf0df (patch) | |
tree | e2894f6cbde68cdb4a176b8541eceb628e42a607 /pcr/zoneminder/zmeventbackup | |
parent | 2874d5896296204c9c6863c6d13e72be392d9fcf (diff) | |
download | abslibre-1187d7cb38d2700e4773d79b1a3d26fd46adf0df.tar.gz abslibre-1187d7cb38d2700e4773d79b1a3d26fd46adf0df.tar.bz2 abslibre-1187d7cb38d2700e4773d79b1a3d26fd46adf0df.zip |
zoneminder: adding new package to [pcr] repo
Diffstat (limited to 'pcr/zoneminder/zmeventbackup')
-rwxr-xr-x | pcr/zoneminder/zmeventbackup | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/pcr/zoneminder/zmeventbackup b/pcr/zoneminder/zmeventbackup new file mode 100755 index 000000000..a14ee22a1 --- /dev/null +++ b/pcr/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=/srv/zoneminder/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 |