#!/bin/sh set -e if [ -z "$SWIFT_CONTAINER" ]; then echo Set SWIFT_CONTAINER exit 1; fi day=$1; shift if [ -z "${day}" ]; then echo "specify date in format yy-mm-dd" exit 1 fi compressed="/tmp/${day}.tgz" dest=${1:-.} if [ -n "$(ls -A $dest)" ]; then echo "destination directory $dest must be empty" exit 1 fi echo "Downloading $pg_small3/base/${day}.tgz" if ! swift download -o $compressed $SWIFT_CONTAINER "base/${day}.tgz" ; then echo "Failed to download base backup $compressed" exit 2 fi tar xvzf $compressed rm $compressed cat > recovery.conf <