diff --git a/README.md b/README.md index d082d1e..6e837a0 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,6 @@ Froxlorbackup Backup your Froxlor Webhosting to another server. Encrypted, via ssh. Works until version 0.9.32. + +SQL works now also for Versions > 0.9.32. +HTML is planned to be backed up with duplicity \ No newline at end of file diff --git a/backup-sql.sh b/backup-sql.sh index 18070f9..214c338 100644 --- a/backup-sql.sh +++ b/backup-sql.sh @@ -1,19 +1,21 @@ #!/bin/bash -# 2013 by Mainboarder.de +# 2014 by Mainboarder.de # # Keep this comment untouched and do not use this software for military purposes. # you are allowed to use this just like you want on your own risk. -# +# # contains lines from http://menzerath.eu/artikel/froxlor-alle-datenbanken-und-verzeichnisse-sichern/ # -path="var/customers/backups/" -temp="var/customers/temp-backup-path/" -encryption="path/to/enc.key" +temp="var/customers/temp-backup-path" +backuppath="/mnt/usb/backups" +encryption="/path/to/enc.key" external="user@extern.server.de" MYSQL_USER="root" MYSQL_PASSWORD="root" +# Programm + # um <> zu vermeiden cd / @@ -27,19 +29,17 @@ databases=`mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -e "SHOW DATABASES;" | grep -E for db in $databases; do mysqldump -u $MYSQL_USER -p$MYSQL_PASSWORD $db > "$temp/$db.sql" done - + # Alle SQL-Dumps in ein Archiv packen -tar cfvz $temp/backup-sql-$datum.tar.gz $temp +tar cfvz $temp/../backup-sql-$datum.tar.gz $temp #Verschlüsseln und gepackte Datei löschen -openssl aes-256-cbc -kfile $encryption -in backup-sql-$datum.tar.gz -out ./backup-sql-$datum.enc.tar.gz +openssl aes-256-cbc -kfile $encryption -in $temp/../backup-sql-$datum.tar.gz -out $temp/backup-sql-$datum.enc.tar.gz -rm backup-sql-$datum.tar.gz +rm $temp/../backup-sql-$datum.tar.gz #Kopieren und verschlüsselte Datei löschen -scp -i /etc/ssh/ssh_host_dsa_key ./backup-sql-$datum.enc.tar.gz $external:/mnt/usb/backups - -rm backup-sql-$datum.enc.tar.gz +scp -i /etc/ssh/ssh_host_dsa_key $temp/backup-sql-$datum.enc.tar.gz $external:$backuppath rm -r $temp mkdir $temp