Program to backup DZ database with DB version in name

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
User avatar
erem
Posts: 230
Joined: Tuesday 27 March 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Amsterdam/netherlands
Contact:

Program to backup DZ database with DB version in name

Post 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.
Attachments
extract-dz-db-version.c
(4.22 KiB) Downloaded 26 times
Last edited by erem on Tuesday 14 April 2020 19:29, edited 1 time in total.
Regards,

Rob
User avatar
Mooms
Posts: 17
Joined: Monday 09 April 2018 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.01
Location: Valkenswaard
Contact:

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

Post by Mooms »

Thank you Rob this is very helpful !
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

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

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
erem
Posts: 230
Joined: Tuesday 27 March 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Amsterdam/netherlands
Contact:

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

Post 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.
Regards,

Rob
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest