pg-backup-file: continue after failures and only report at the end
authorPeter Palfrader <peter@palfrader.org>
Sun, 4 Feb 2018 10:25:59 +0000 (11:25 +0100)
committerPeter Palfrader <peter@palfrader.org>
Sun, 4 Feb 2018 10:26:06 +0000 (11:26 +0100)
modules/roles/files/postgresql_server/pg-backup-file

index ff2a493..08e6d38 100755 (executable)
@@ -60,6 +60,7 @@ checksum=""
 bn="`basename "$file"`"
 targetname="$cluster.$what.$bn"
 logtuple="($myhost,$targetname,$size,$checksum)"
+failures=""
 
 for target in $backuphost; do
        if [ "${target#/}" != "$target" ]; then
@@ -71,7 +72,10 @@ for target in $backuphost; do
 
                ssh -C "$target" $ssh_options -o BatchMode=yes -o ServerAliveInterval=90 $myhost store-file pg "$targetname" "$size" "$checksum" < "$file"
                if [ "$?" != 0 ]; then
-                       croak "remote store for $logtuple failed."
+                       failures="$failures $logtuple"
                fi
        fi
 done
+if [ "$failures" != "" ]; then
+       croak "remote store for$failures failed."
+fi