diff options
-rwxr-xr-x | backup-pg | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2002, 2003, 2004, 2005 Peter Palfrader <peter@palfrader.org> +# Copyright (c) 2002, 2003, 2004, 2005, 2017 Peter Palfrader <peter@palfrader.org> # # 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 |