Created
January 16, 2018 11:07
-
-
Save huettern/d4e690b7611250648e684c63e85e7d65 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# GitLab Backup script | |
# Backup config | |
docker exec -t gitlab /bin/sh -c 'umask 0077; tar cfz /var/opt/gitlab/backups/$(date "+etc-gitlab-config-%s.tgz") -C / etc/gitlab' | |
# Backup data | |
sudo docker exec -t gitlab gitlab-rake gitlab:backup:create | |
# Delete old config | |
sudo find /srv/gitlab/data/backups/ -type f -name 'etc-gitlab-*' -mtime +30 -exec rm {} \; | |
# Copy to backup server | |
sudo rsync -rvz --delete "/srv/gitlab/data/backups" "/media/beeblebroxgitlab/backup" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment