From fa932e04d33d71439423732804dffbb6933ad3fc Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 20 Feb 2017 11:40:29 +0100 Subject: Make backup-pg work on a modern pg --- backup-pg | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'backup-pg') diff --git a/backup-pg b/backup-pg index 671afc5..ef4d257 100755 --- a/backup-pg +++ b/backup-pg @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2002, 2003, 2004, 2005 Peter Palfrader +# Copyright (c) 2002, 2003, 2004, 2005, 2017 Peter Palfrader # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -64,7 +64,7 @@ else exit 1 fi -$SUDO psql $PORT --list --tuples-only | grep -v '^.*:' | awk '$1 != "" {print $1}' | +$SUDO psql $PORT --quiet --no-align --tuples-only --command "SELECT datname FROM pg_database" | while read db; do if [ "$db" = "template0" -o "$db" = "template1" ] ; then continue; @@ -72,13 +72,13 @@ while read db; do file="$BASE/$DATE-$PREFIX$db.plain" $SUDO pg_dump $PORT --create --format=p "$db" > "$file" - nice bzip2 -- "$file" + nice pigz --no-name --no-time -- "$file" - md5=`md5sum -- "$file.bz2" | awk '{print $1}'` - if [ -e "$BASE/MD5-$md5" ]; then - rm -- "$file.bz2" - ln "$BASE/MD5-$md5" "$file.bz2" + digest=`md5sum -- "$file.gz" | awk '{print $1}'` + if [ -e "$BASE/DGST-$digest" ]; then + rm -- "$file.gz" + ln "$BASE/DGST-$digest" "$file.gz" else - ln "$file.bz2" "$BASE/MD5-$md5" + ln "$file.gz" "$BASE/DGST-$digest" fi done -- cgit v1.2.3