Skip to content

Instantly share code, notes, and snippets.

@yyfrankyy
Last active December 28, 2017 20:57
Show Gist options
  • Save yyfrankyy/5981215 to your computer and use it in GitHub Desktop.
Save yyfrankyy/5981215 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`
@yyfrankyy
Copy link
Author

这个是备份整个数据库的,project,issue,wiki,user这些。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment