diff --git a/README.md b/README.md index 914dd57..4adffab 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ Backup your Froxlor Webhosting (or anything else) to another server. Encrypted, Works for all versions. 0. install duplicity and all required packages -1. copy the script to the froxlorserver and run it as /$PATH/backup-server.sh full -2. Add a cronjob like "17 2 * * * /$PATH/backup-server.sh" +1. copy the script to the froxlorserver and run it as `/$PATH/backup-server.sh full` +2. Add a cronjob like `17 2 * * * /$PATH/backup-server.sh` 3. Let the magic happen You can restore your data with -duplicity --file-to-restore neddedFile $EXTERNALPATH/TO//media/mount/duplicity/path/to/file/ /where/to/save/now +`duplicity --file-to-restore neddedFile $EXTERNALPATH/TO//media/mount/duplicity/path/to/file/ /where/to/save/now` diff --git a/backup-server.sh b/backup-server.sh index d2e933e..6c536aa 100644 --- a/backup-server.sh +++ b/backup-server.sh @@ -34,6 +34,12 @@ BHOST='host.example.com' mysql_user="root" mysql_password="P4aSsw04d" +# Backup iptables? +iptables=false + +# Backup ip6tables? +ip6tables=false + # Temp Dir for SQL Backups (must exist) temp="var/customers/temp_backup" @@ -53,6 +59,9 @@ ALGO=AES ############################## +IPTABLESEXEC=`which iptables-save` +IP6TABLESEXEC=`which ip6tables-save` + ### MySQL Export # Date create datum=$(date +"%d"."%m"."%y") @@ -64,9 +73,17 @@ databases=`mysql -u $mysql_user -p$mysql_password -e "SHOW DATABASES;" -Nsr | gr # export all databases for db in $databases; do - mysqldump -u $mysql_user -p$mysql_password $db > "$temp/$db.sql" + mysqldump -u $mysql_user -p$mysql_password $db > "$temp/$db.sql" done +# export iptables and ip6tables +if [ $iptables = true ]; then + $IPTABLESEXEC > "$temp/iptables" +fi +if [ $ip6tables = true ]; then + $IP6TABLESEXEC > "$temp/ip6tables" +fi + ### Backup if [ $ALGO ]; then