From 6b1670f9d7586fc4e9f917685e61500c47c0457f Mon Sep 17 00:00:00 2001 From: Pijus Kamandulis Date: Thu, 17 Jan 2019 01:53:20 +0200 Subject: [PATCH] Create pull-backups.sh --- backup/pull-backups.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 backup/pull-backups.sh diff --git a/backup/pull-backups.sh b/backup/pull-backups.sh new file mode 100644 index 0000000..68ac021 --- /dev/null +++ b/backup/pull-backups.sh @@ -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