Page 1 of 1

Wiki page on automating backups of DB

Posted: Thursday 01 October 2020 15:15
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?

Re: Wiki page on automating backups of DB

Posted: Thursday 01 October 2020 18:15
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.