Only sync the database backup if pg_dump succeeds
authorTom Hughes <tom@compton.nu>
Mon, 9 Oct 2017 23:50:25 +0000 (00:50 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 9 Oct 2017 23:50:25 +0000 (00:50 +0100)
cookbooks/db/templates/default/backup-db.erb

index 492dded..78ae1c8 100644 (file)
@@ -5,9 +5,7 @@
 D=`date +%Y-%m-%d`
 F=/store/backup/osm-${D}.dmp
 
-pg_dump --user=backup --format=custom --file=$F openstreetmap
-
-export RSYNC_RSH="ssh -ax"
-rsync $F backup.openstreetmap.org::backup
+pg_dump --user=backup --format=custom --file=$F openstreetmap && \
+  rsync --rsh="ssh -ax" $F backup.openstreetmap.org::backup
 
 rm -f $F