backupdatabase.php results in Unauthorized
Moderator: leecollings
-
- Posts: 2
- Joined: Tuesday 15 June 2021 9:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
backupdatabase.php results in Unauthorized
Hi everybody,
For months I was using /usr/bin/curl -s http://localhost:8080/backupdatabase.php to get the domoticz database to load it into a small datawarehouse.
But since a few weeks, the php script is returning 401 Unauthorized.
In Domoticz, I have set my subnet (192.168.178.*) as lokal network to avoid logging in.
But the script also fails from my raspberry itself.
Is the script still supported? Or should I set something else?
Thanks!
Maarten
For months I was using /usr/bin/curl -s http://localhost:8080/backupdatabase.php to get the domoticz database to load it into a small datawarehouse.
But since a few weeks, the php script is returning 401 Unauthorized.
In Domoticz, I have set my subnet (192.168.178.*) as lokal network to avoid logging in.
But the script also fails from my raspberry itself.
Is the script still supported? Or should I set something else?
Thanks!
Maarten
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: backupdatabase.php results in Unauthorized
On what version of Domoticz are you?
You should also add 127.0.0.* to the access list in Setup - Settings to be sure when accessing from localhost.
You should also add 127.0.0.* to the access list in Setup - Settings to be sure when accessing from localhost.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 2
- Joined: Tuesday 15 June 2021 9:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: backupdatabase.php results in Unauthorized
Hi,
I am using 2021.1 as version.
Already tried to add 127.0.0.1 but that did not work.
Local command: /usr/bin/curl -s http://localhost:8080/backupdatabase.php > domoticz.backup
results in a domoticz.backup file containing
I am using 2021.1 as version.
Already tried to add 127.0.0.1 but that did not work.
Local command: /usr/bin/curl -s http://localhost:8080/backupdatabase.php > domoticz.backup
results in a domoticz.backup file containing
Code: Select all
<html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>
- erem
- Posts: 230
- Joined: Tuesday 27 March 2018 12:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Amsterdam/netherlands
- Contact:
Re: backupdatabase.php results in Unauthorized
which user runs domoticz?
which user rus the curl command?
does work?
which user rus the curl command?
does
Code: Select all
sudo /usr/bin/curl -s http://localhost:8080/backupdatabase.php > domoticz.backup
Regards,
Rob
Rob
- TomTom
- Posts: 4
- Joined: Sunday 26 September 2021 22:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Contact:
Re: backupdatabase.php results in Unauthorized
Hi, have the same issue with a returning http 401.
running with sudo does not solve the issue for me.
Any ideas how to solve this?
Thanks and regards, Tom
running with sudo does not solve the issue for me.
Trying to run it via localhost entry and with the local ip address in curl parameters, with the pi and sudo user, as well as domoticz user and password in curl parameters - for all combinations always receiving a http 401.erem wrote: ↑Monday 28 June 2021 11:52 ...
doeswork?Code: Select all
sudo /usr/bin/curl -s http://localhost:8080/backupdatabase.php > domoticz.backup
Any ideas how to solve this?
Thanks and regards, Tom
Re: backupdatabase.php results in Unauthorized
Install sqlite3 and do
Of course set the appropriate variables before the command. I backup directly to my NAS every 5 minutes
It is much more efficient and runs faster (approx. 30 Mb in less then 1.5 seconds).
Code: Select all
/usr/bin/sqlite3 $SOURCEPATH$SOURCEFILE ".backup $MOUNTPOINT/$BACKUPFILE"
It is much more efficient and runs faster (approx. 30 Mb in less then 1.5 seconds).
Last edited by EddyG on Friday 08 October 2021 12:04, edited 1 time in total.
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: backupdatabase.php results in Unauthorized
For me this command works perfectly.erem wrote: ↑Monday 28 June 2021 11:52 which user runs domoticz?
which user rus the curl command?
doeswork?Code: Select all
sudo /usr/bin/curl -s http://localhost:8080/backupdatabase.php > domoticz.backup
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Re: backupdatabase.php results in Unauthorized
I see in the source that you have to be an admin user in Domoticz for this to work. Could that be the problem?
Try using it without the '> domoticz.db' If you skip that part the database backup.db will created in /tmp/backup.db in Linux and userdatafolder/backup.db in Windows
Try using it without the '> domoticz.db' If you skip that part the database backup.db will created in /tmp/backup.db in Linux and userdatafolder/backup.db in Windows
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: backupdatabase.php results in Unauthorized
Mmm interesting.
Domoticz Version: 2023.1 it does give me the DB as a backup
Domoticz Version: 2024.4 gives me 0 bytes
Response Code is
So that does not seem to be unauthorized.
Via the Domoticz Web Interface -> Settings > Backup and Restore -> Backup I also receive 0 bytes in the download.
Code: Select all
sudo /usr/bin/curl -v -s http://domo_ip:domo_port/backupdatabase.php > file2.db
Domoticz Version: 2024.4 gives me 0 bytes
Response Code is
Code: Select all
HTTP/1.1 200 OK
Code: Select all
[31/Mar/2024:11:12:43.561 +0200] "GET /backupdatabase.php HTTP/1.1" 200 0 - "curl/7.74.0"
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: backupdatabase.php results in Unauthorized
2024.4 gives me normal size backup when doing it through menu Settings > Backup and Restore -> Backup.
So it seems something is wrong in your setup.
So it seems something is wrong in your setup.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: backupdatabase.php results in Unauthorized
Hehe probably. But with debug logging on and no errors... hard to find out.
What does the PHP command do?
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: backupdatabase.php results in Unauthorized
It is some kind of symbolic link into the Domoticz executable that makes a backup.....
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 536
- Joined: Monday 20 March 2023 14:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Somewhere in NL
- Contact:
Re: backupdatabase.php results in Unauthorized
Indeed it has nothing to do with php
In this script I use an alternative methode: https://www.domoticz.com/forum/viewtopi ... te#p306625
If you install sqlite3 then this command is much faster and can run outside of Domoticz when ever you want.
The sqlite3 .backup command is made for that.
In this script I use an alternative methode: https://www.domoticz.com/forum/viewtopi ... te#p306625
If you install sqlite3 then this command is much faster and can run outside of Domoticz when ever you want.
Code: Select all
sqlite3 $SOURCEPATH$SOURCEFILE ".backup $MOUNTPOINT/$BACKUPFILE"
Logic will get you from A to B. Imagination will take you everywhere.
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: backupdatabase.php results in Unauthorized
Mm interesting indeed. tried it with running Domoticz but received:Kedi wrote: ↑Monday 01 April 2024 13:45 Indeed it has nothing to do with php
In this script I use an alternative methode: https://www.domoticz.com/forum/viewtopi ... te#p306625
If you install sqlite3 then this command is much faster and can run outside of Domoticz when ever you want.The sqlite3 .backup command is made for that.Code: Select all
sqlite3 $SOURCEPATH$SOURCEFILE ".backup $MOUNTPOINT/$BACKUPFILE"
Code: Select all
sudo sqlite3 /home/pi/domoticz/domoticz.db ".backup /mnt/home/backup/domoticzdb/domoticzups_20240402204245_167_.db"
Code: Select all
Error: database is locked
Let me check on the DEMO machine.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Who is online
Users browsing this forum: No registered users and 1 guest