Je tente de faire un backup des principaux fichier de domoticz. J'utilise le script suivant :
Code : Tout sélectionner
#!/bin/bash
# LOCAL/FTP/SCP/MAIL PARAMETERS
SERVER="192.168.0.254" # IP of Network disk, used for ftp
USERNAME="identifiantfreebox" # FTP username of Network disk used for ftp
PASSWORD="Passefreebox" # FTP password of Network disk used for ftp
DESTDIR="/Disque dur/RPi" # used for temorarily storage
DOMO_IP="127.0.0.1" # Domoticz IP
DOMO_PORT="8080" # Domoticz port
### END OF USER CONFIGURABLE PARAMETERS
TIMESTAMP=`/bin/date +%Y%m%d%H%M%S`
BACKUPFILE="domoticz_BDD_$TIMESTAMP.db" # backups will be named "domoticz_YYYYMMDDHHMMSS.db.gz"
BACKUPFILEGZ="$BACKUPFILE".gz
SCRIPTSGZ="domoticz_scripts_$TIMESTAMP.tar.gz"
### Stop Domoticz, create backup, ZIP it and start Domoticz again
service domoticz.sh stop
/usr/bin/curl -s http://$DOMO_IP:$DOMO_PORT/backupdatabase.php > /tmp/$BACKUPFILE
gzip -9 /tmp/$BACKUPFILE
### Send to Network disk through FTP
curl -s --disable-epsv -v -T"/tmp/$BACKUPFILEGZ" -u"$USERNAME:$PASSWORD" "ftp://$SERVER/Disque dur/RPi/"
### Remove temp backup file
/bin/rm /tmp/$BACKUPFILEGZ
### Compression des scripts
tar -zcvf /tmp/$SCRIPTSGZ /home/pi/domoticz/scripts
service domoticz.sh start
### Envoi par FTP
curl -s --disable-epsv -v -T"/tmp/$SCRIPTSGZ" -u"$USERNAME:$PASSWORD" "ftp://$SERVER/Disque dur/RPi/"
### Suppression du fichier temporaire
/bin/rm /tmp/$SCRIPTSGZ
### Done!
Ci-joint un des fichiers en exemple
Merci