From: Peter Palfrader Date: Sun, 8 Jun 2014 06:47:07 +0000 (+0200) Subject: Make a way to run a pg base backup for only a single cluster X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=712626737451089f49db41611805f0b63774e16a;p=mirror%2Fdsa-puppet.git Make a way to run a pg base backup for only a single cluster --- diff --git a/modules/postgres/files/backup_server/postgres-make-base-backups b/modules/postgres/files/backup_server/postgres-make-base-backups index 9a9d18803..d96aeee79 100755 --- a/modules/postgres/files/backup_server/postgres-make-base-backups +++ b/modules/postgres/files/backup_server/postgres-make-base-backups @@ -47,6 +47,18 @@ else console="" fi +if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then + echo "Usage: $0 [:]" + exit 0 +fi + +if [ "$#" -gt 0 ]; then + forcehostport="$1" + shift +else + forcehostport="" +fi + export PGSSLMODE=verify-full export PGSSLROOTCERT=/etc/ssl/debian/certs/ca.crt @@ -55,6 +67,11 @@ date=$(date "+%Y%m%d-%H%M%S") while read host port username cluster version; do [ "${host#\#}" = "$host" ] || continue + if [ -n "$forcehostport" ] && [ "$forcehostport" != "$host:$port" ]; then + [ "$verbose" -gt 0 ] && echo "Skipping $host:$port $version/$cluster." + continue + fi + label="$date-$host-$cluster-$version-backup" [ "$verbose" -gt 0 ] && echo "Doing $host:$port $version/$cluster: $label"