Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- domoticz_backup.sh:
- #!/bin/bash
- # LOCAL/FTP/SCP/MAIL PARAMETERS
- SERVER="192.168.0.124" # IP of Network disk, used for ftp
- USERNAME="" # FTP username of Network disk used for ftp
- PASSWORD="" # FTP password of Network disk used for ftp
- DESTDIR="Marco/Domoticz_Backup/" # used for temorarily storage
- DOMO_IP="192.168.0.124" # Domoticz IP
- DOMO_PORT="8084" # 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
- ### Create backup and ZIP it
- /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/$DESTDIR/"
- ### Remove temp backup file
- /bin/rm /tmp/$BACKUPFILEGZ
- ### Done!
- domoticz_backup_scripts.sh:
- #!/bin/bash
- # LOCAL/FTP/SCP/MAIL PARAMETERS
- SERVER="192.168.0.124" # IP of Network disk, used for ftp
- USERNAME="" # FTP username of Network disk used for ftp
- PASSWORD="" # FTP password of Network disk used for ftp
- DESTDIR="Marco/Domoticz_Backup/" # used for temorarily storage
- DOMO_IP="192.168.0.124" # Domoticz IP
- DOMO_PORT="8084" # Domoticz port
- ### END OF USER CONFIGURABLE PARAMETERS
- TIMESTAMP=`/bin/date +%Y%m%d%H%M%S`
- ### Backup Script Folder
- tar -zcvf /tmp/domoticz_scripts_$TIMESTAMP.tar.gz /volume1/@appstore/domoticz/scripts/
- ### Send to Network disk through FTP
- curl -s --disable-epsv -v -T"/tmp/domoticz_scripts_$TIMESTAMP.tar.gz" -u"$USERNAME:$PASSWORD" "ftp://$SERVER/$DESTDIR/"
- ### Remove temp backup file
- /bin/rm /tmp/domoticz_scripts_$TIMESTAMP.tar.gz
- ### Done!
- domoticz_backup_www.sh:
- #!/bin/bash
- # LOCAL/FTP/SCP/MAIL PARAMETERS
- SERVER="192.168.0.124" # IP of Network disk, used for ftp
- USERNAME="" # FTP username of Network disk used for ftp
- PASSWORD="" # FTP password of Network disk used for ftp
- DESTDIR="Marco/Domoticz_Backup/" # used for temorarily storage
- DOMO_IP="192.168.0.124" # Domoticz IP
- DOMO_PORT="8084" # Domoticz port
- ### END OF USER CONFIGURABLE PARAMETERS
- TIMESTAMP=`/bin/date +%Y%m%d%H%M%S`
- ### Backup Script Folder
- tar -zcvf /tmp/domoticz_www_$TIMESTAMP.tar.gz /volume1/@appstore/domoticz/www/
- ### Send to Network disk through FTP
- curl -s --disable-epsv -v -T"/tmp/domoticz_www_$TIMESTAMP.tar.gz" -u"$USERNAME:$PASSWORD" "ftp://$SERVER/$DESTDIR/"
- ### Remove temp backup file
- /bin/rm /tmp/domoticz_www_$TIMESTAMP.tar.gz
- ### Done!
- Vergeet niet de bestanden te CHMOD'en:
- chmod 777 domoticz_backup.sh
- chmod 777 domoticz_backup_scripts.sh
- chmod 777 domoticz_backup_www.sh
- Crontab zoals ik die heb (elke nacht een backup van de DB en 1 keer in de week op maandags een backup van de scripts / www directory):
- 0 0 * * * root sh /volume1/@appstore/domoticz/scripts/domoticz_backup.sh
- 2 0 * * 1 root sh /volume1/@appstore/domoticz/scripts/domoticz_backup_scripts.sh
- 4 0 * * 1 root sh /volume1/@appstore/domoticz/scripts/domoticz_backup_www.sh
Advertisement
Add Comment
Please, Sign In to add comment