This way you can undo changes to zones if you are doing some tweaking or some large scale changes that causes too many triggers or not enough.
Code: Select all
#!/bin/bash
HOST=localhost
DB=zm
USER=zmuser
PASS=zmpass
VERSION=`mysql -u${USER} -p${PASS} -h${HOST} ${DB} < scripts/version.sql | grep -v Value`
mysqldump -u${USER} -p${PASS} -h${HOST} ${DB} Zones | sed 's$VALUES ($VALUES\n($g' | sed 's$),($),\n($g'| grep -v "Dump completed on" > zones/Zones_$VERSION.sql
DATE=`date +"%d-%m-%Y %H:%M"`
MESSAGE="zones updated at ${DATE}"
git add zones/*
git commit -am "$MESSAGE"
git push
- Get version number of the zoneminder database. e.g: 1.35.10
- dump the zones table to folder called zones and name it Zones_1.35.10.sql
- commit the changes to a local git repository
- push the changes up a remote repo
If you ever want to roll it back you can download the the .sql for date and load it back into the database. restart zm to pickup the changes.