ldap,mysql,pgsql: use bash pipefail option so that failed dumps are reported as such
[matthijs/upstream/backupninja.git] / handlers / ldap.in
index 0b0166ecc4eff999993e07cb4b76372a80834afa..fda24d08878304f044821d08c5608cfde171402f 100644 (file)
@@ -1,4 +1,5 @@
 # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
+# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
 #
 # openldap backup handler script for backupninja
 #
@@ -85,12 +86,12 @@ if [ "$ldif" == "yes" ]; then
          fi
 
          if [ "$compress" == "yes" ]; then
-            execstr="$execstr | $GZIP > $dumpdir/$dbsuffix.ldif.gz"
+            execstr="$execstr | $GZIP --rsyncable > $dumpdir/$dbsuffix.ldif.gz"
          else
             execstr="$execstr > $dumpdir/$dbsuffix.ldif"
          fi
          debug "$execstr"
-         output=`su root -c "$execstr" 2>&1`
+         output=`su root -c "set -o pipefail ; $execstr" 2>&1`
          code=$?
          if [ "$code" == "0" ]; then
             debug $output