No more heavy exim on franck
[mirror/dsa-puppet.git] / modules / postgres / files / backup_server / postgres-make-base-backups
index ee9213f..9a9d188 100755 (executable)
@@ -39,6 +39,7 @@ if [ -t 0 ]; then
        verbose=1
 else
        verbose=0
+fi
 
 if [ "$verbose" -gt 0 ]; then
        console="--progress --verbose"
@@ -62,6 +63,10 @@ while read host port username  cluster version; do
        trap "rm -f '$tmp'" EXIT
 
        /usr/lib/postgresql/"$version"/bin/pg_basebackup --format=tar --pgdata=- --label="$label" --host="$host" --port="$port" --username="$username" --no-password $console | pigz > "$tmp"
+       if ! [ "${PIPESTATUS[0]}" -eq 0 ]; then
+               echo >&2 "pg_basebackup failed with exit code ${PIPESTATUS[0]}"
+               exit 1
+       fi
        mv "$tmp" "$ROOTDIR/${host%%.*}/$target"
 done << EOF
 chopin.debian.org      5432    debian-backup           dak             9.1