Create pull-backups.sh

This commit is contained in:
Pijus Kamandulis 2019-01-17 01:53:20 +02:00 committed by GitHub
parent 527adc8555
commit 6b1670f9d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

17
backup/pull-backups.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
DATE=$(date +"%d-%m-%Y")
PULL_DIR='backups'
SSH_KEY='/home/bakerupper/.ssh/bakerupper_key'
SERVERS=(
'bakeruper;mail.pikami.org;/home/bakeruper/backups/*'
'bakeruper;baguette.pikami.org;/home/bakeruper/backups/*'
)
# Pull backups
for i in "${SERVERS[@]}"
do
conf=(${i//;/ })
mkdir -p $PULL_DIR/$DATE/${conf[1]}
scp -i $SSH_KEY ${conf[0]}@${conf[1]}:${conf[2]} $PULL_DIR/$DATE/${conf[1]}
done