Skip to content

Instantly share code, notes, and snippets.

@stefanopulze
Last active April 16, 2019 12:49
Show Gist options
  • Select an option

  • Save stefanopulze/d0271b848a046ef74cf958ced9ef0038 to your computer and use it in GitHub Desktop.

Select an option

Save stefanopulze/d0271b848a046ef74cf958ced9ef0038 to your computer and use it in GitHub Desktop.
Gitlab backup to ownCloud
#!/usr/bin/env bash
cd /var/opt/gitlab/backups/
gitlab-rake gitlab:backup:create
filename="$(ls -t /var/opt/gitlab/backups/ | head -1)"
date=$(date -I)
basicAuth="username:password"
remotedir="https://owncloud_remote_url/remote.php/webdav/backups" # make sure folder exists
# Add sensitive information, needed for complete restore
tar -uvf $filename /etc/gitlab/
curl -v -T $filename -u "$basicAuth" "${remotedir}/${date}-${filename}"
rm $filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment