Automatic backup to FTP results in a non usable .db

All kinds of 'OS' scripts

Moderator: leecollings

Post Reply
BSPI
Posts: 1
Joined: Tuesday 21 November 2017 9:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Almere
Contact:

Automatic backup to FTP results in a non usable .db

Post by BSPI »

Dear all,

I use the script from the wiki to back-up my domoticz database to a FTP folder.
The database is arriving in the FTP folder but is not usable to restore.
If I try to open the database I can see:
<html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>

I tried "service domoticz.sh stop" and "service domoticz.sh start" by adding a '#' but is also not working.
I also added 192.168.178.0 in Local networks in the Settings from domoticz and "automatic backup" is also enabled.

I really hope someone can push me in the correct direction.

Thanks!
Bert

This is my script: (based on source domoticz wiki)

# LOCAL/FTP/SCP/MAIL PARAMETERS
SERVER="192.168.178.10" # IP of Network disk, used for ftp
USERNAME="domoticz" # FTP username of Network disk used for ftp
PASSWORD="" # FTP password of Network disk used for ftp
DESTDIR="/opt/backup" # used for temorarily storage
DOMO_IP="192.168.178.22" # Domoticz IP
DOMO_PORT="8080" # Domoticz port
### END OF USER CONFIGURABLE PARAMETERS
TIMESTAMP=`/bin/date +%Y%m%d%H%M%S`
BACKUPFILE="domoticz_$TIMESTAMP.db" # backups will be named "domoticz_YYYYMMDDHHMMSS.db.gz"
BACKUPFILEGZ="$BACKUPFILE".gz
### Stop Domoticz, create backup, ZIP it and start Domoticz again
#service domoticz.sh stop
#sleep 30
/usr/bin/curl -s http://$DOMO_IP:$DOMO_PORT/backupdatabase.php > /tmp/$BACKUPFILE
#service domoticz.sh start
gzip -9 /tmp/$BACKUPFILE
### Send to Network disk through FTP
curl -s --disable-epsv -v -T"/tmp/$BACKUPFILEGZ" -u"$USERNAME:$PASSWORD" "ftp://$SERVER/domoticz/master/" $
### Remove temp backup file
/bin/rm /tmp/$BACKUPFILEGZ
### Done!
ErikAtSpijk
Posts: 16
Joined: Sunday 11 March 2018 22:03
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

Re: Automatic backup to FTP results in a non usable .db

Post by ErikAtSpijk »

Had the same issue, it has to do with access rights. I never resolved the issue but a work around that works is to go to settings in Domotics and at "Local Networks (no username/password):" add the IP address of domoticz.

It's probably less secure but works for me.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests