Last active
August 14, 2017 21:20
-
-
Save ArnaudValensi/5f7207dd0dc970f13630 to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/bin/bash | |
# To uncryp: | |
# $ ccrypt -d --key YourRandomKeyToCrypt fileToUncrypt | |
SERVER=host0.mindup.io | |
USER=root | |
DEST_PATH=/home/backup_arnaud/ | |
KEY=YourRandomKeyToCrypt | |
BACKUP_NAME=/tmp/$(date +%s)-backup.tar.gz | |
# Remove files older than 2 days | |
find /home/srv/docker/gitlab/gitlab/backups/ -mindepth 1 -mtime +2 -delete | |
tar zcvf $BACKUP_NAME \ | |
/home/srv \ | |
/root/gitlab-docker \ | |
/root/backup \ | |
/etc/nginx | |
ccrypt -e --key $KEY $BACKUP_NAME | |
scp $BACKUP_NAME.cpt $USER@$SERVER:$DEST_PATH | |
# remove older than 10 days | |
ssh root@$SERVER 'find /srv/backup_arnaud/ -mindepth 1 -mtime +10 -delete' | |
rm -fr $BACKUP_NAME.cpt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment