Exporting a single camera?

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
User avatar
elfking
Posts: 35
Joined: Tue Mar 14, 2006 2:48 am
Location: Sonoma, California

Exporting a single camera?

Post by elfking »

Hi there,
Maybe there is already a feature for this in the later versions? I have been using 1.22.2 for a long time, and am just upgrading to 1.23.3 (mdv2007)

If its not able to (which I didnt read any new feature adds that it could...) export a single camera, ALL settings for it. Don't need the events or anything of that sort.

Exporting them in a file/files which could then be used to import them onto another zoneminder box. (same version running of course.) When I go through and configure each camera's sensitivity and or oother various configs. It would be nice to be able to export and import them around.

There might not be that much demand for such a thing, but maybe there is a chance? Its similar to the db_backup which is great.. I can't wait to use it.. but a single camera might be nice as well...

Thank you for your time, and EVERYONES effort in this lovely project.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

I could put something like this together pretty easy, I'll have a look at it tonight or tomorrow night and have something for you.
User avatar
elfking
Posts: 35
Joined: Tue Mar 14, 2006 2:48 am
Location: Sonoma, California

Post by elfking »

cordel wrote:I could put something like this together pretty easy, I'll have a look at it tonight or tomorrow night and have something for you.
Thank you very much for looking into it. :D
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Okay so now the question is what spacificly do you want exported?
Do you want zones with it?
What settings do you want?
User avatar
elfking
Posts: 35
Joined: Tue Mar 14, 2006 2:48 am
Location: Sonoma, California

Post by elfking »

cordel wrote:Okay so now the question is what spacificly do you want exported?
Do you want zones with it?
What settings do you want?
Zones would be lovely. For myself, everything if possible would be best. I just deal with Remote/IP camera's... but to be able to export it all, and just import it to a new machine would be perfect.
User avatar
elfking
Posts: 35
Joined: Tue Mar 14, 2006 2:48 am
Location: Sonoma, California

Post by elfking »

Did anything come of this? ;) Just curious if there might be some progress made, or if a wall was hit...
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Sorry mate, I spaced it. Seeing how I just wrapped up from three shifts at work, give me a couple days to polish it and get it posted.
User avatar
elfking
Posts: 35
Joined: Tue Mar 14, 2006 2:48 am
Location: Sonoma, California

Post by elfking »

cordel wrote:Sorry mate, I spaced it. Seeing how I just wrapped up from three shifts at work, give me a couple days to polish it and get it posted.
No problem at all, I don't mean to be annoying or anything of that sort, was just seeing if I had missed over it being posted. This stuff is free, I can't complain about anything. I am (others too im sure) very grateful for all that is done around here.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Monitor/Zones import/export script.

Post by cordel »

Okay so here is a short version as the original that I started has grown into something else and will likely be a while. This will work as long as you use it with the same ZM version as it was exported from. As far as exporting a single cam with zones for that cam, I still have to work out the associations between the two that change when inserted individually. I'll get that going here shortly and post an updated script.

Meantime here is a little something to fill in:

Code: Select all

#!/bin/sh
#----------------------------------------------------------------------------
#       USAGE:		./zmxport-monitors
#
#       DESCRIPTION:	Tool to X port monitors and zones for ZoneMinder
#       OPTIONS:	-x export
#                       -i import
#       REQUIREMENTS:	mysqldump, tar, gzip, mysql
# 
#       AUTHOR:		Copyright 2008 Corey DeLasaux
#       VERSION:  	0.2
#       CREATED:  	5/27/2008 21:15:00 PDT
#       LICENSE:	Reciprocal Public License 1.5 (RPL1.5)
#=============================================================================
ZM_CONFIG="/etc/zm.conf"     # Change this to the path of your zm.conf if different
ZM_BACKUP_PATH="$HOME"       # $HOME stores the file in your users home directory


if [ -f $ZM_CONFIG ]; then
    . $ZM_CONFIG
else
    echo "ERROR: $ZM_CONFIG not found."
    exit 1
fi

export()
        {
        sql=/tmp/ZM_Monitors.sql

        echo "Backing up Monitors and Zones..."
        echo "Accessing Database..."
        mysqldump  --user=$ZM_DB_USER --password=$ZM_DB_PASS $ZM_DB_NAME Monitors Zones --add-drop-table > $sql

        echo "Compressing File..."
        rm -f  $ZM_BACKUP_PATH/ZM_Monitors.tar.gz
        tar -cvf $ZM_BACKUP_PATH/ZM_Monitors.tar $sql
        gzip $ZM_BACKUP_PATH/ZM_Monitors.tar
        rm -f $sql
        echo "Done."
        exit 0

        }

import()
        {
        if [ ! -f $ZM_BACKUP_PATH/ZM_Monitors.tar.gz ] ; then

                echo ""
                echo "ZM System Restore script"
                echo "----------------------------"
                echo "Check that your ZM_Monitors.tar.gz is in your users" 
                echo "home directory and this script will restore your configuration."
                echo ""

        exit 1
    fi

    echo "## stopping zm"
    $ZM_PATH_BIN/zmpkg.pl stop

    echo "## Restoring..."
    cd $ZM_BACKUP_PATH
    tar xvfz ZM_Monitors.tar.gz

    echo "## Restoring Monitor Database"
    /usr/bin/mysql --user=$ZM_DB_USER --password=$ZM_DB_PASS $ZM_DB_NAME < ZM_Monitors.sql
    rm -rf ZM_Monitors.sql

    echo "## Starting zm"
    $ZM_PATH_BIN/zmpkg.pl start

    echo "## Done."
    exit 0
}

case "$1" in
	'-x')
	    export
	    ;;
	'-i')
	    import
	    ;;
	*)
	echo "Usage: $0"
	echo "-x To export monitors and zones"
	echo "-i To import monitors and zones"
	RETVAL=1
	;;
esac
exit $RETVAL
Also downloadable from my site in the extras category.
Post Reply