diff --git a/roles/kde-backup/templates/backup-eresida.sh b/roles/kde-backup/templates/backup-eresida.sh index 42536f4..db207c3 100644 --- a/roles/kde-backup/templates/backup-eresida.sh +++ b/roles/kde-backup/templates/backup-eresida.sh @@ -1,16 +1,18 @@ +#!/bin/bash LOCATION=/root/{{backup_directory}} find $LOCATION -name '*.tar' -mtime +7 | xargs rm -f # Backup configuration and list of installed packages 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` # Backup GitLab tar -czf $LOCATION/gitlab-config.`date +%w`.tgz -C / srv/gitlab/gitlab/config -sudo -u git -H sh -c 'cd /srv/gitlab/gitlab && bundle exec rake gitlab:backup:create RAILS_ENV=production SKIP=repositories CRON=1' +sudo -u git -H sh -c 'cd /srv/gitlab/gitlab && bundle exec rake --trace gitlab:backup:create RAILS_ENV=production SKIP=repositories' &> backup.log +if [[ $? -ne 0 ]]; then cat backup.log; fi mv /srv/gitlab/gitlab/tmp/backups/*gitlab_backup.tar $LOCATION/ # Transfer the backups to the backup server lftp -f ~/bin/backup-options