aboutsummaryrefslogtreecommitdiff
path: root/handlers/pgsql.in
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2010-01-08 23:40:23 +0100
committerintrigeri <intrigeri@boum.org>2010-01-08 23:40:23 +0100
commit47313bca65de105145f2168538b294a9bcc0e98d (patch)
tree8fcc10551cae627e432cb9366608cf2c935817e0 /handlers/pgsql.in
parent49bfd02bd3ee6eccc2eaa0a7c668c46b4a15af0a (diff)
downloadbackupninja-47313bca65de105145f2168538b294a9bcc0e98d.tar.gz
backupninja-47313bca65de105145f2168538b294a9bcc0e98d.tar.bz2
ldap,mysql,pgsql: use bash pipefail option so that failed dumps are reported as such
This should fix Redmine bug #1340. This option makes pipelines return as status the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands exit successfully. See bash(1) for details. E.g. this prevents the following from exiting with status 0 (!) if pg_dumpall fails: pg_dumpall | gzip
Diffstat (limited to 'handlers/pgsql.in')
-rw-r--r--handlers/pgsql.in8
1 files changed, 4 insertions, 4 deletions
diff --git a/handlers/pgsql.in b/handlers/pgsql.in
index d7839fb..77a73fe 100644
--- a/handlers/pgsql.in
+++ b/handlers/pgsql.in
@@ -75,13 +75,13 @@ chmod 700 $vroot$backupdir
if [ "$databases" == "all" ]; then
if [ $usevserver = yes ]; then
if [ "$compress" == "yes" ]; then
- execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL | $GZIP --rsyncable > '$backupdir/${vsname}.sql.gz'\""
+ execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP --rsyncable > '$backupdir/${vsname}.sql.gz'\""
else
execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${vsname}.sql'\""
fi
else
if [ "$compress" == "yes" ]; then
- execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL | $GZIP --rsyncable > '$backupdir/${localhost}-all.sql.gz'\""
+ execstr="su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP --rsyncable > '$backupdir/${localhost}-all.sql.gz'\""
else
execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${localhost}-all.sql'\""
fi
@@ -104,13 +104,13 @@ else
for db in $databases; do
if [ $usevserver = yes ]; then
if [ "$compress" == "yes" ]; then
- execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | $GZIP --rsyncable > '$backupdir/${db}.sql.gz'\""
+ execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMP $db | $GZIP --rsyncable > '$backupdir/${db}.sql.gz'\""
else
execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | > '$backupdir/${db}.sql'\""
fi
else
if [ "$compress" == "yes" ]; then
- execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db | $GZIP --rsyncable > '$backupdir/${db}.sql.gz'\""
+ execstr="su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMP $db | $GZIP --rsyncable > '$backupdir/${db}.sql.gz'\""
else
execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db > '$backupdir/${db}.sql'\""
fi