Page 1 of 1

Backup script "backupdatabase.php" not working.

Posted: Saturday 26 January 2019 16:31
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

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

Posted: Saturday 26 January 2019 16:42
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.

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

Posted: Saturday 26 January 2019 16:52
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?

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

Posted: Saturday 26 January 2019 17:04
by Kamil
Yes, You're right, sorry.

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

Posted: Saturday 26 January 2019 17:12
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'"

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

Posted: Saturday 26 January 2019 22:27
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.

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

Posted: Saturday 26 January 2019 22:30
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

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

Posted: Thursday 31 January 2019 14:07
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.

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

Posted: Friday 19 April 2019 1:38
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?

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

Posted: Friday 19 April 2019 7:04
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.