commit 3d2829511b662f3ded6bffc14655408137c9c0a5 Author: Mainboarder Date: Tue Feb 25 20:11:29 2014 +0100 initial commit diff --git a/backup-server.sh b/backup-server.sh new file mode 100644 index 0000000..6650fa2 --- /dev/null +++ b/backup-server.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# 2013 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. +# + +path="var/customers/backups/" +temp="var/customers/temp-backup-path/" +encryption="path/to/enc.key" +external="user@extern.server.de" + +# um <> zu vermeiden +cd / + +# Ordner finden +for f in $( ls $path); do + +# HTML-Dateien finden + for g in $( ls $path$f | grep html); do + +# Dateien kopieren + cp $path$f/$g $temp + done +done + +#Datum erstellen +datum=$(date +"%d"."%m"."%y") + +#Dateien zusammenpacken und komprimieren +tar cfvz backup-html-$datum.tar.gz $temp + +#Verschlüsseln und gepackte Datei löschen +openssl aes-256-cbc -kfile $encryption -in backup-html-$datum.tar.gz -out ./backup-html-$datum.enc.tar.gz + +rm backup-html-$datum.tar.gz + +#Kopieren und verschlüsselte Datei löschen +scp -i /etc/ssh/ssh_host_dsa_key ./backup-html-$datum.enc.tar.gz $external:/mnt/usb/backups + +rm backup-html-$datum.enc.tar.gz + +rm -r $temp +mkdir $temp diff --git a/backup-sql.sh b/backup-sql.sh new file mode 100644 index 0000000..81bc222 --- /dev/null +++ b/backup-sql.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# 2013 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. +# + +path="var/customers/backups/" +temp="var/customers/temp-backup-path/" +encryption="path/to/enc.key" +external="user@extern.server.de" + +# um <> zu vermeiden +cd / + +# Ordner finden +for f in $( ls $path); do + +# SQL-Dateien finden + for g in $( ls $path$f | grep sql); do + +# Dateien kopieren + cp $path$f/$g $temp + done +done + +#Datum erstellen +datum=$(date +"%d"."%m"."%y") + +#Dateien zusammenpacken und komprimieren +tar cfvz 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 + +rm 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 + +rm -r $temp +mkdir $temp