
Please if someone needs help with script, just drop me a private message and I should get a notification email!
Moderator: leecollings
Code: Select all
### Backup Script Folder
tar -zcvf /tmp/domoticz_scripts_$TIMESTAMP.tar.gz /home/pi/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
Code: Select all
'!b.gzCan't open '/tmp/domoticz_20150313172005
curl: try 'curl --help' or 'curl --manual' for more information
* Illegal characters found in URL
/bin/rm: cannot remove `/tmp/domoticz_20150313172005\r.db.gz\r\r': No such file or directory
Found out the temp folder isn't correct. Make a folder on the pi where the script can backup to. I just made a folder in /home/pi/domoticz/scripts/backupLJ80 wrote:Hi all,
I followed all steps from the wiki but wen I am at the step for testing I get this message back:
What have I done wrong or what am i missing?Code: Select all
'!b.gzCan't open '/tmp/domoticz_20150313172005 curl: try 'curl --help' or 'curl --manual' for more information * Illegal characters found in URL /bin/rm: cannot remove `/tmp/domoticz_20150313172005\r.db.gz\r\r': No such file or directory
Code: Select all
crontab -e
Code: Select all
# Version 15-12-2014:
3 * * * * rsync -r -t --delete /home/pi/domoticz /mnt/syno/Domoticz
Code: Select all
curl -s --disable-epsv -v -T"/tmp/$BACKUPFILEGZ" -u"$USERNAME:$PASSWORD" "sftp://$SERVER/Domoticz/Backups/DB/"
Code: Select all
* About to connect() to 192.168.XX.XX port 22 (#0)
* Trying 192.168.XX.XX...
* connected
* Connected to 192.168.XX.XX (192.168.XX.XX) port 22 (#0)
* SFTP 0x9a50a8 state change from SSH_STOP to SSH_INIT
* SFTP 0x9a50a8 state change from SSH_INIT to SSH_S_STARTUP
* SFTP 0x9a50a8 state change from SSH_S_STARTUP to SSH_HOSTKEY
* SSH MD5 fingerprint: MyFingerprint
* SSH host check: 2, key: <none>
* SFTP 0x9a50a8 state change from SSH_HOSTKEY to SSH_SESSION_FREE
* SFTP 0x9a50a8 state change from SSH_SESSION_FREE to SSH_STOP
* SSH DISCONNECT starts now
* SSH DISCONNECT is done
* Closing connection #0
* SSL peer certificate or SSH remote key was not OK
Code: Select all
#!/bin/bash
DOMO_IP="192.168.4.4" # Domoticz IP
DOMO_PORT="8084" # Domoticz port
### END OF USER CONFIGURABLE PARAMETERS
TIMESTAMP=`/bin/date +%Y%m%d%H%M%S`
BACKUPFILE="domoticzbackup_$TIMESTAMP.db" # backups will be named "domoticz_YYYYMMDDHHMMSS.db.gz"
BACKUPFILEGZ="$BACKUPFILE".gz
#Create backup and make tar archives
/usr/bin/curl -s http://$DOMO_IP:$DOMO_PORT/backupdatabase.php > /volume1/dataschijf/Domoticz_backup/database/$BACKUPFILE
tar -zcvf /volume1/dataschijf/Domoticz_backup/scripts/domoticz_scripts_$TIMESTAMP.tar.gz /volume1/@appstore/domoticz/var/scripts/
tar -zcvf /volume1/dataschijf/Domoticz_backup/www/domoticz_wwwfolder_$TIMESTAMP.tar.gz /volume1/@appstore/domoticz/www/
#Delete backups older than 31 days
/usr/bin/find /volume1/dataschijf/Domoticz_backup/database/ -name '*.db' -mtime +31 -delete
/usr/bin/find /volume1/dataschijf/Domoticz_backup/scripts/ -name '*.tar.gz' -mtime +31 -delete
/usr/bin/find /volume1/dataschijf/Domoticz_backup/www/ -name '*.tar.gz' -mtime +31 -delete
Code: Select all
55 23 * * * root sh /volume1/@appstore/domoticz/var/scripts/bash/domobackup.sh
Maybe you can use gzip/gzunzip instead.ThinkPad wrote:The backup is just stored as a .db file, the two folders (www & script) are compressed in a .tar.gz file. I prefer .zip, but have not yet found out how to configure the 'tar' parameters.
Thanks, I am using this script to backup the files to Onedrive via CloudSync (encrypted since one of the last updates).ThinkPad wrote:Just posting my script here, maybe someone can use it. It creates a backup of the database, the www folder (i have custom frontpage.html for my tablet in it) and the scripts folder.
It is based on locations on my NAS, and the backups are also stored on this same NAS.
The backup is just stored as a .db file, the two folders (www & script) are compressed in a .tar.gz file. I prefer .zip, but have not yet found out how to configure the 'tar' parameters.Code: Select all
#!/bin/bash DOMO_IP="192.168.4.4" # Domoticz IP DOMO_PORT="8084" # Domoticz port ### END OF USER CONFIGURABLE PARAMETERS TIMESTAMP=`/bin/date +%Y%m%d%H%M%S` BACKUPFILE="domoticzbackup_$TIMESTAMP.db" # backups will be named "domoticz_YYYYMMDDHHMMSS.db.gz" BACKUPFILEGZ="$BACKUPFILE".gz #Create backup and make tar archives /usr/bin/curl -s http://$DOMO_IP:$DOMO_PORT/backupdatabase.php > /volume1/dataschijf/Domoticz_backup/database/$BACKUPFILE tar -zcvf /volume1/dataschijf/Domoticz_backup/scripts/domoticz_scripts_$TIMESTAMP.tar.gz /volume1/@appstore/domoticz/var/scripts/ tar -zcvf /volume1/dataschijf/Domoticz_backup/www/domoticz_wwwfolder_$TIMESTAMP.tar.gz /volume1/@appstore/domoticz/www/ #Delete backups older than 31 days /usr/bin/find /volume1/dataschijf/Domoticz_backup/database/ -name '*.db' -mtime +31 -delete /usr/bin/find /volume1/dataschijf/Domoticz_backup/scripts/ -name '*.tar.gz' -mtime +31 -delete /usr/bin/find /volume1/dataschijf/Domoticz_backup/www/ -name '*.tar.gz' -mtime +31 -delete
I run it every evening at 23:55 by a cronjob:Code: Select all
55 23 * * * root sh /volume1/@appstore/domoticz/var/scripts/bash/domobackup.sh
This is what I still needed. Thanks!ThinkPad wrote:Just posting my script here, maybe someone can use it. It creates a backup of the database, the www folder (i have custom frontpage.html for my tablet in it) and the scripts folder.
It is based on locations on my NAS, and the backups are also stored on this same NAS.
Code: Select all
#Delete backups older than 31 days /usr/bin/find /volume1/dataschijf/Domoticz_backup/database/ -name '*.db' -mtime +31 -delete /usr/bin/find /volume1/dataschijf/Domoticz_backup/scripts/ -name '*.tar.gz' -mtime +31 -delete /usr/bin/find /volume1/dataschijf/Domoticz_backup/www/ -name '*.tar.gz' -mtime +31 -delete
I wish i could backup the WWW and Script folder. But i dont have a NAS server. I changed your script with my location but nothing happens.ThinkPad wrote:Just posting my script here, maybe someone can use it. It creates a backup of the database, the www folder (i have custom frontpage.html for my tablet in it) and the scripts folder.
It is based on locations on my NAS, and the backups are also stored on this same NAS.
The backup is just stored as a .db file, the two folders (www & script) are compressed in a .tar.gz file. I prefer .zip, but have not yet found out how to configure the 'tar' parameters.Code: Select all
#!/bin/bash DOMO_IP="192.168.4.4" # Domoticz IP DOMO_PORT="8084" # Domoticz port ### END OF USER CONFIGURABLE PARAMETERS TIMESTAMP=`/bin/date +%Y%m%d%H%M%S` BACKUPFILE="domoticzbackup_$TIMESTAMP.db" # backups will be named "domoticz_YYYYMMDDHHMMSS.db.gz" BACKUPFILEGZ="$BACKUPFILE".gz #Create backup and make tar archives /usr/bin/curl -s http://$DOMO_IP:$DOMO_PORT/backupdatabase.php > /volume1/dataschijf/Domoticz_backup/database/$BACKUPFILE tar -zcvf /volume1/dataschijf/Domoticz_backup/scripts/domoticz_scripts_$TIMESTAMP.tar.gz /volume1/@appstore/domoticz/var/scripts/ tar -zcvf /volume1/dataschijf/Domoticz_backup/www/domoticz_wwwfolder_$TIMESTAMP.tar.gz /volume1/@appstore/domoticz/www/ #Delete backups older than 31 days /usr/bin/find /volume1/dataschijf/Domoticz_backup/database/ -name '*.db' -mtime +31 -delete /usr/bin/find /volume1/dataschijf/Domoticz_backup/scripts/ -name '*.tar.gz' -mtime +31 -delete /usr/bin/find /volume1/dataschijf/Domoticz_backup/www/ -name '*.tar.gz' -mtime +31 -delete
I run it every evening at 23:55 by a cronjob:Code: Select all
55 23 * * * root sh /volume1/@appstore/domoticz/var/scripts/bash/domobackup.sh
Code: Select all
#!/bin/bash
# LOCAL/FTP/SCP/MAIL PARAMETERS
SERVER="192.168.1.1" # IP of Network disk, used for ftp
USERNAME="myuser" # FTP username of Network disk used for ftp
PASSWORD="Myspasswrd" # FTP password of Network disk used for ftp
DESTDIR="/opt/backup" # used for temorarily storage
DOMO_IP="DOMO_ip" # Domoticz IP
DOMO_PORT="DOMO_port" # 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
tar -zcvf /Seagate_Expansion_Drive/Domoticz/scripts/domoticz_scripts_$TIMESTAMP.tar.gz /home/pi/domoticz/scripts
tar -zcvf /Seagate_Expansion_Drive/Domoticz/domoticz_wwwfolder_$TIMESTAMP.tar.gz /home/pi/domoticz/www
### Send to Network disk through FTP
curl -s --disable-epsv -v -T"/tmp/$BACKUPFILEGZ" -u"$USERNAME:$PASSWORD" "ftp://$SERVER/Seagate_Expansion_Drive/Domoticz/"
### Remove temp backup file
/bin/rm /tmp/$BACKUPFILEGZ
### Done!
Sorry, can't help you. I don't use FTP so i don't know how to modify it to reflect to your situationJustintime wrote:I wish i could backup the WWW and Script folder. But i dont have a NAS server. I changed your script with my location but nothing happens.ThinkPad wrote:Just posting my script here, maybe someone can use it. It creates a backup of the database, the www folder (i have custom frontpage.html for my tablet in it) and the scripts folder.
It is based on locations on my NAS, and the backups are also stored on this same NAS.
[...]
[...]
Code: Select all
sudo: domoticz_backup.sh: command not found
Code: Select all
#!/bin/bash
# LOCAL/FTP/SCP/MAIL PARAMETERS
SERVER="IP-ADDRESS Network Disk" # IP of Network disk, used for: ftp mail scp
USERNAME="username" # FTP username of Network disk used for: ftp mail scp
PASSWORD="password" # FTP password of Network disk used for: f$
DESTDIR="" # used for: local
DOMO_IP="IP-ADRESS Domoticz" # Domoticz IP used for all
DOMO_PORT="8080" # Domoticz port used for all
### END OF USER CONFIGURABLE PARAMETERS
TIMESTAMP=`/bin/date +%Y%m%d%H%M%S`
BACKUPFILE="domoticz_$TIMESTAMP.db"
BACKUPFILEGZ="$BACKUPFILE".gz
Users browsing this forum: No registered users and 0 guests