Last active
December 16, 2015 12:49
-
-
Save jweslley/5437568 to your computer and use it in GitHub Desktop.
Revisions
-
jweslley revised this gist
Apr 22, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,8 +7,8 @@ set -e DB_USERNAME=username DB_PASSWORD=secret BACKUP_DIR='/path/to/backup/' TIMESTAMP=`date +'%Y%m%d%H%M%S'` # Mysql database -
jweslley created this gist
Apr 22, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #!/bin/sh # Usage: # - Save this file in /etc/cron.daily/gitlab # - Enable execution permission: chmod +x /etc/cron.daily/gitlab set -e DB_USERNAME=username DB_PASSWORD=secret BACKUP_DIR='/mnt/backup/gitlab/' TIMESTAMP=`date +'%Y%m%d%H%M%S'` # Mysql database mysqldump --user=$DB_USERNAME --password='$DB_PASSWORD' gitlabhq_production | gzip > "$BACKUP_DIR/$TIMESTAMP-mysql.sql.gz" # Uploads tar zcf "$BACKUP_DIR/$TIMESTAMP-uploads.tar.gz" \ --directory /home/git/gitlab/public/ \ uploads # Git repositories tar zcf "$BACKUP_DIR/$TIMESTAMP-repositories.tar.gz" \ --directory /home/git/ \ repositories # Remove backup files older than 5 days find $BACKUP_DIR -mtime +5 -type f -exec rm {} \;