Page 1 of 1

Program to backup DZ database with DB version in name

Posted: Tuesday 14 April 2020 19:22
by erem
L.S.,

i run various versions of domoticz, and it seems every version has a different database format.
there is a database version in the domoticz database table preferences, but i did not want to open every database
to inspect the version number.

so i wrote attached program extract-dz-db-version to return the version number of the database.

you could use it like this.

Code: Select all

#!/bin/bash
#
# purpose: show usage of extract-dz-db-version
#
#
# Version	Date		Reason
# 0.0.1		2020-04-05	initial release

STRING="$( ./extract-dz-db-version  /home/pi/domoticz/domoticz.db)"
echo Domoticz Database version is $STRING

# example usage
# /usr/bin/curl -s http://127.0.0.1:8080/backupdatabase.php >/path/to/domoticz.db.$STRING
i hope others have a use for this, so i share the code in the hope somebody will benefit from it.

Re: Program to backup DZ database with DB version in name

Posted: Tuesday 14 April 2020 19:25
by Mooms
Thank you Rob this is very helpful !

Re: Program to backup DZ database with DB version in name

Posted: Tuesday 14 April 2020 19:27
by waaren
erem wrote: Tuesday 14 April 2020 19:22 L.S.,

i run various versions of domoticz, and it seems every version has a different database format.
there is a database version in the domoticz database table preferences, but i did not want to open every database
to inspect the version number.

so i wrote attached program extract-dz-db-version to return the version number of the database.
Or have a look here

Re: Program to backup DZ database with DB version in name

Posted: Tuesday 14 April 2020 19:41
by erem
@waaren,

that is indeed a very useful table.

i see

Version Commit DB
11649 3aa55f248 139

however, with the new versioning scheme i have a hard time relating the version number 2020.1 to version 11649.
the previous scheme would show Version 4.10717 (which is not in the table) for the stable release, where you need to assume the db version is 134

thanks for the link, much appreciated.