Backup script "backupdatabase.php" not working.

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
brommetje
Posts: 67
Joined: Sunday 16 February 2014 17:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Backup script "backupdatabase.php" not working.

Post by brommetje »

Version: 4.10364
Platform: RPi 3B

Automatic backup not working any more after an malformed DB but repaired, I do not know why. My work-around was to use backupdatabase.php through the cron that was working till I did an update from 4.10360 to 4.10364.

Code: Select all

/usr/bin/curl -s http://127.0.0.1:8080/backupdatabase.php > /SYNDS/backup/domoticz.db
I can not find this backupdatabase.php script if I search for it (find) then it is not there on file level? What should be the location?
Is it somewhere in the DB or is it hard coded somewhere, how is it working and how can I debug it?

Owner of the DB is root is that OK or should it belong to user pi?

Code: Select all

-rw-r-----  1 root root 54833152 Jan 26 16:20 domoticz.db
Is there another way to make a ONLINE backup and how to debug this problem any idea?

Martin
Kamil
Posts: 8
Joined: Saturday 26 January 2019 15:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Newest β
Location: PL
Contact:

Re: Backup script "backupdatabase.php" not working.

Post by Kamil »

Hi,
backup makes sense when it is saved on another media.
That's why I suggest you use this guide(db backup and other important folders):

http://cezarowy.blogspot.com/2017/11/ko ... lderu.html

it is in Polish but you can translate it very easily using, for example, using a Google translator.
brommetje
Posts: 67
Joined: Sunday 16 February 2014 17:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Backup script "backupdatabase.php" not working.

Post by brommetje »

@kamil this is also based on the same backupdatabase.php script but for me it is not working anymore and I can not find it, where is it located?
For the moment I can use this line

Code: Select all

sudo sqlite3 /SYNDS/backup/PI3/backups.DB/domoticz.snoepie.201901291640.db
question is still are the user rights for the DB fine and where is that backupdatabase.php script located can somebody check it for me please?
Kamil
Posts: 8
Joined: Saturday 26 January 2019 15:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Newest β
Location: PL
Contact:

Re: Backup script "backupdatabase.php" not working.

Post by Kamil »

Yes, You're right, sorry.
brommetje
Posts: 67
Joined: Sunday 16 February 2014 17:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Backup script "backupdatabase.php" not working.

Post by brommetje »

sorry copied the wrong line should be

Code: Select all

sudo sqlite3 /home/pi/domoticz/domoticz.db ".backup '/SYNDS/backup/domoticz.201901291640.db'"
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Backup script "backupdatabase.php" not working.

Post by waaren »

brommetje wrote: Saturday 26 January 2019 16:52 @kamil this is also based on the same backupdatabase.php script but for me it is not working anymore and I can not find it, where is it located?
For the moment I can use this line

Code: Select all

sudo sqlite3 /SYNDS/backup/PI3/backups.DB/domoticz.snoepie.201901291640.db
question is still are the user rights for the DB fine and where is that backupdatabase.php script located can somebody check it for me please?
There is no backupupdatabase.php script. It is a command inside an html file that calls an internal sqlite3 command.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Backup script "backupdatabase.php" not working.

Post by waaren »

brommetje wrote: Saturday 26 January 2019 16:31 Owner of the DB is root is that OK or should it belong to user pi?

Code: Select all

-rw-r-----  1 root root 54833152 Jan 26 16:20 domoticz.db
Is there

Code: Select all

this should be -rw-r--r-- 1 root root 16912384 Jan 26 22:25 domoticz.db
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Backup script "backupdatabase.php" not working.

Post by Toulon7559 »

Have same issue, but only on the RPI_B, not on the RPI_3B of my 2 operational Raspberries&Domoticz.
Or is difference in hardware not relevant?
One consequence is that at least Backup-at-the-Setup, and the 1st, 3rd and 4th script from Wiki for 'Backup to external HDD' is not running for the said RPI_B.

Obviously best to 'repair' operation with backupdatabase.php, but tired of searching, have practically solved the 'problem' of Backup-to-external-HDD in another way for both RPIs (and any RPI to come):
- on all PCs in my LAN I have sync-software running named AllWay Sync for automated backup/copy to NAS(SYNDS), etc.
- have installed vsftpd on each Raspberry for sure&easy external transfer of files
- have programmed one AllWaySync-instance to read a daily copy of /home/pi/domoticz/domoticz.db from each Raspberry and to put these files in designated Backup-folders at my NAS. Is a 2-step approach, but effective, and due to 'pulling' not dependent on any function in the Raspberries other than ftp.
- (as fallback) have programmed an AllWaySync-instance on another PC to perform that action each week, writing to different folders at the destination drives, to have really parallel backup, not just refresh/overwrite. 'More of the same'.
- because those PCs are either in 24/7-operation or periodically used, the probabilty that automatic backup is made is very high, and now redundant.
AllWaySync in the destination folder retains a selected number of older file-versions, which implies plenty of 'safety-copies'.
With automatic clean-up if the number of copies is exceeeded.
- Restore at Domoticz' Setup of domoticz.db from the PC which is running the webbased control for the subject Raspberry&Domoticz, is by pointing to the backedup file at the NAS.

One small, but significant aspect when using an 'external partner' like AllWaySync for backup:
Attention needed that AllWaySync should not be active when re-installing Domoticz at the Raspberry, because then you have the risk (before you notice) that the sync-software automatically overwrites the latest backup by the newly installed domoticz.db!
Before you restart AllWaySync, you must be sure to have restored in Domoticz the latest backup-version of domoticz.db!

;-) Almost without programming (just setup) all required functions: should be safe enough ......
Now looking which other folders/files from the Raspberries are worth to be included in that procedure.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

Re: Backup script "backupdatabase.php" not working.

Post by felix63 »

brommetje wrote: Saturday 26 January 2019 16:31 Version: 4.10364
Platform: RPi 3B

Automatic backup not working any more after an malformed DB but repaired, I do not know why. My work-around was to use backupdatabase.php through the cron that was working till I did an update from 4.10360 to 4.10364.

Code: Select all

/usr/bin/curl -s http://127.0.0.1:8080/backupdatabase.php > /SYNDS/backup/domoticz.db
I can not find this backupdatabase.php script if I search for it (find) then it is not there on file level? What should be the location?
Is it somewhere in the DB or is it hard coded somewhere, how is it working and how can I debug it?

Owner of the DB is root is that OK or should it belong to user pi?

Code: Select all

-rw-r-----  1 root root 54833152 Jan 26 16:20 domoticz.db
Is there another way to make a ONLINE backup and how to debug this problem any idea?

Martin
Hi,

Did you find a solution for this problem?
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Backup script "backupdatabase.php" not working.

Post by Egregius »

Since the beginning that I use Domoticz I use just rsync to make a backup of the complete domoticz folder to my nas.
Recovered multiple times without problem.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest