Skip to content

Instantly share code, notes, and snippets.

@mrgonext
Forked from yyfrankyy/BackupGitlab.sh
Created December 1, 2015 06:52
Show Gist options
  • Save mrgonext/58af31f7d17870c0018e to your computer and use it in GitHub Desktop.
Save mrgonext/58af31f7d17870c0018e to your computer and use it in GitHub Desktop.
Backup Gitlab Day by day to Dropbox
#!/bin/sh
# You might want to put this script in crontab, backup day by day.
#
# $ sudo -u git -H crontab -l
# $ 0 0 1 * * /path/to/your/BackupGitlab.sh
cd /home/git/gitlab
/usr/local/bin/bundle exec rake gitlab:backup:create RAILS_ENV=production
# Create a dropbox app https://www.dropbox.com/developers
# Get an Uploader https://github.com/andreafabrizi/Dropbox-Uploader
# Run this script first, it saved config to ~/.dropbox_uploader by default.
# Upload last backup to Dropbox
/path/to/your/dropbox_uploader.sh -f /path/to/your/.dropbox_uploader upload `find /home/git/gitlab/tmp/backups/ -type f -exec ls -1rt "{}" + | tail -n 1`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment