20 lines
529 B
Bash
Executable File
20 lines
529 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# needs to run as root
|
|
#
|
|
# setup as cron job:
|
|
#
|
|
# sudo crontab -e
|
|
# 0 2 * * * /bin/gitlab-backup.sh
|
|
#
|
|
|
|
# Create a time-stamped .tar file in the current directory.
|
|
# The .tar file will be readable only to root.
|
|
cd /var/opt/gitlab/backups/ || exit
|
|
sh -c 'umask 0077; tar -cf $(date "+%s-%F-etc-gitlab.tar") -C / etc/gitlab'
|
|
|
|
# run GitLab system backup
|
|
gitlab-rake gitlab:backup:create CRON=1
|
|
|
|
# sync with Google Cloud Storage bucket
|
|
/home/m/code/google-cloud-sdk/bin/gsutil rsync -r . gs://git-berlin-backups |