Wiki page on automating backups of DB

All kinds of 'OS' scripts

Moderator: leecollings

Post Reply
WillJ
Posts: 2
Joined: Sunday 20 September 2020 21:38
Target OS: -
Domoticz version:
Contact:

Wiki page on automating backups of DB

Post by WillJ »

Hi Guys,

I have been trying to follow the wiki which explains how to backup the DB using FTP.
This is what it says (I trimmed the stuff which is not relevant) :
Script to backup to FTP-server (only Domoticz database)
The script below will save a copy of your 'domoticz.db' (database) to the folder specified.
However, you probably also use some scripts that you want to backup too, so you probably want the script further down this page.

### Stop Domoticz, create backup, ZIP it and start Domoticz again
service domoticz.sh stop
/usr/bin/curl -s http://$DOMO_IP:$DOMO_PORT/backupdatabase.php > /tmp/$BACKUPFILE
service domoticz.sh start

Addition: If this doesn't work, try to outcomment the "service domoticz.sh stop" and "service domoticz.sh start" by adding a '#' in front (so for example"#service domoticz.sh stop"). It seems that domoticz on a Raspberry sometimes does not stop soon enough, which will result in an empty database file.
Now.. maybe I am crazy here, but if I stop the domoticz service how can I then call the backupdatabase.php?
For me, this logic is totally wrong - this will only work if the stop command is disabled.

After stopping the service, we should gzip Domoticz.db file direct from the filesystem.. no?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Wiki page on automating backups of DB

Post by waaren »

WillJ wrote: Thursday 01 October 2020 15:15 Now.. maybe I am crazy here, but if I stop the domoticz service how can I then call the backupdatabase.php?
For me, this logic is totally wrong - this will only work if the stop command is disabled.
You are right!

Please feel free to update this wikipage.
If you don't have a wiki account yet, you can send me a PM with your email address and your preferred user-id. I will then create a new user-ID for you.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest