diff --git a/roles/kde-backup/templates/backup-postbox.sh b/roles/kde-backup/templates/backup-postbox.sh index 9e27a82..d2bdc65 100755 --- a/roles/kde-backup/templates/backup-postbox.sh +++ b/roles/kde-backup/templates/backup-postbox.sh @@ -1,31 +1,31 @@ LOCATION=/root/{{backup_directory}} -find $LOCATION -name '*gz' -mtime +6 | xargs rm -f +find $LOCATION -name '*xz' -mtime +6 | xargs rm -f # Grab our databases for DATABASE in `mysqlshow | grep -v "information_schema" | grep -v "performance_schema" | grep -v "mysql" | tail -n+4 | awk '{print $2}'`; do - mysqldump --skip-extended-insert $DATABASE | gzip -9 - > $LOCATION/db.$DATABASE.`date +%w`.sql.gz + mysqldump --skip-extended-insert $DATABASE | xz - > $LOCATION/db.$DATABASE.`date +%w`.sql.xz done # Get a listing of all mailman archives we want to backup cd / ls -d1 var/lib/mailman/archives/private/* | grep -v mbox > ~/backup-excludes cd ~/ # Backup mailman archives -tar -czf $LOCATION/mailman.`date +%w`.tar.gz -C / --exclude-from=/root/backup-excludes var/lib/mailman +tar -cJf $LOCATION/mailman.`date +%w`.tar.xz -C / --exclude-from=/root/backup-excludes var/lib/mailman # Backup the mailman install and some other tools -tar -czf $LOCATION/mailman-install.`date +%w`.tar -C / usr/lib/mailman -tar -czf $LOCATION/root-scripts.`date +%w`.tgz -C / root/bin -tar -czf $LOCATION/commitfilter.`date +%w`.tgz -C / --exclude=home/commitfilter/procmail.log home/commitfilter +tar -cJf $LOCATION/mailman-install.`date +%w`.tar.xz -C / usr/lib/mailman +tar -cJf $LOCATION/root-scripts.`date +%w`.tar.xz -C / root/bin +tar -cJf $LOCATION/commitfilter.`date +%w`.tar.xz -C / --exclude=home/commitfilter/procmail.log home/commitfilter # Cleanup following the Mailman backup rm /root/backup-excludes # Backup the system configuration, crontabs and package listing tar -czf $LOCATION/etc.`date +%w`.tgz -C / etc/ tar -czf $LOCATION/crontabs.`date +%w`.tgz -C / var/spool/cron/ dpkg -l > $LOCATION/dpkg.`date +%w` # Transfer to the backup server lftp -q -f ~/bin/backup-options