Unfortunately these examples have some security flaws.
I did it differently in a simple and safe way, using the standard backup option and scp over SSH for which no plain password needs to be saved in a script file.
The procedure is:
on the domoticz local machine:
Code: Select all
cd .ssh/
ssh-keygen -t rsa
scp id_rsa.pub pi@remoteserver:/home/pi/.sshOn the remoteserver:
Code: Select all
cd .ssh
mv id_rsa.pub authorized_keys
chmod 700 authorized_keys
mkdir /home/pi/domoticz $ adapt to your needs
mkdir /home/pi/domoticz/backups
mkdir /home/pi/domoticz/backups/dailyon the domoticz local machine:
Code: Select all
#!/bin/bash
SERVER="remoteserver.local" # IP or name of server
USER="pi"
REMOTEPATH="/home/pi/domoticz/backups/daily/" # adapt to your needs
LOCALPATH="/home/pi/domoticz/backups/daily/"
### END OF USER CONFIGURABLE PARAMETERS
TIMESTAMP=`/bin/date +%d`
BACKUPFILE="backup-day-$TIMESTAMP-Domoticz.db" # name of daily backup file
scp -r $LOCALPATH/$BACKUPFILE $USER@$SERVER:$REMOTEPATH More details on my website:
https://www.agri-vision.nl/portal/artic ... z-database