summaryrefslogtreecommitdiff
path: root/backup-pg
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2017-02-20 11:40:29 +0100
committerPeter Palfrader <peter@palfrader.org>2017-02-20 11:40:29 +0100
commitfa932e04d33d71439423732804dffbb6933ad3fc (patch)
treebff6ec1ad4c7df30f86c10380aa5113dfac65f6f /backup-pg
parent6182e4c763afdadeb0f232c5257f233dfee970b3 (diff)
Make backup-pg work on a modern pg
Diffstat (limited to 'backup-pg')
-rwxr-xr-xbackup-pg16
1 files changed, 8 insertions, 8 deletions
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 <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