2 #===============================================================================
6 # USAGE: ./eventdump.sh
8 # DESCRIPTION: Uses mysqldump to create a .sql file for individual zm
9 # events to make Event table recovery possible by doing a
10 # 'find' search in ZoneMinder the events directory
13 # REQUIREMENTS: --- mysqldump
16 # AUTHOR: Ross Melin <rdmelin@gmail.com>
19 # CREATED: 03/06/2008 11:51:19 AM PST
21 #===============================================================================
23 # Edit these to suit your configuration
24 ZM_CONFIG
=/etc
/zm.conf
25 MYSQLDUMP
=/usr
/bin
/mysqldump
26 EVENTSDIR
=/var
/lib
/zm
/www
/events
28 # The rest should not need editing
30 # Get the mysql user and password
32 MYDUMPOPTS
="--user=$ZM_DB_USER --password=$ZM_DB_PASS --skip-opt --compact --quick --no-create-info"
35 for tag
in $
(find $EVENTSDIR -amin -65 -name ".[0-9]*")
37 EVENT_PATH
=$
(echo $tag |cut
-f 1 -d .
)
38 EVENT_ID
=$
(echo $tag |cut
-f 2 -d .
)
39 # Dump the sql statements needed to reload the Events, Frames and Stats tables
41 echo "-- ZM_DB_VERSION=$ZM_VERSION
44 $MYSQLDUMP $MYDUMPOPTS --where="Id=$EVENT_ID" zm Events
>> $EVENT_PATH.sql
45 $MYSQLDUMP $MYDUMPOPTS --where="Eventid=$EVENT_ID" zm Frames
>> $EVENT_PATH.sql
46 $MYSQLDUMP $MYDUMPOPTS --where="Eventid=$EVENT_ID" zm Stats
>> $EVENT_PATH.sql