Backup gitlab script

#!/bin/bash
/home/git/gitlab
fn=`sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production | grep 'Creating backup archive:' | awk '{print $4}'`
scp /home/git/gitlab/tmp/backups/$fn [email protected]:/root/backups/
echo "Backed up file /home/git/gitlab/tmp/backups/$fn to [email protected]."

Old:

#!/bin/bash
/home/git/gitlab
fn=`sudo -u git -H rake RAILS_ENV=production gitlab:backup:create | grep 'Creating backup archive:' | awk '{print $4}'`
scp /home/git/gitlab/tmp/backups/$fn [email protected]:/root/backups/
echo "Backed up file /home/git/gitlab/tmp/backups/$fn to [email protected]."

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.