X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=handlers%2Fldap;fp=handlers%2Fldap;h=ee46831092d10688be9d67d09401c7329346aeb5;hb=fe7ee521a660ef38e5657c31eefb14b95f22827f;hp=7492e691f57192538227f5fa5f026eb180945918;hpb=a2436c2ba4abc165b8300578b9fd80437b9bc201;p=matthijs%2Fupstream%2Fbackupninja.git diff --git a/handlers/ldap b/handlers/ldap index 7492e69..ee46831 100644 --- a/handlers/ldap +++ b/handlers/ldap @@ -46,10 +46,18 @@ if [ "$ldif" == "yes" ]; then fi if [ "$method" == "slapcat" ]; then - execstr="$SLAPCAT -f $conf -b $dbsuffix" + if [ "$compress" == "yes" ]; then + execstr="$SLAPCAT -f $conf -b $dbsuffix | $GZIP" + else + execstr="$SLAPCAT -f $conf -b $dbsuffix" + fi debug "$execstr" else - execstr="$LDAPSEARCH -x -L -b ""$dbsuffix"" -D ""$binddn"" -y $passwordfile" + if [ "$compress" == "yes" ]; then + execstr="$LDAPSEARCH -x -L -b ""$dbsuffix"" -D ""$binddn"" -y $passwordfile | $GZIP" + else + execstr="$LDAPSEARCH -x -L -b ""$dbsuffix"" -D ""$binddn"" -y $passwordfile" + fi [ -f "$passwordfile" ] || fatal "Password file $passwordfile not found. When method is set to ldapsearch, you must also specify a password file." debug "$execstr" fi @@ -64,7 +72,11 @@ if [ "$ldif" == "yes" ]; then fatal "Couldn't create ldif dump file: $dumpdir/$dbsuffix.ldif" fi - output=`$execstr > $dumpdir/$dbsuffix.ldif` + if [ "$compress" == "yes" ]; then + output=`$execstr > $dumpdir/$dbsuffix.ldif.gz` + else + output=`$execstr > $dumpdir/$dbsuffix.ldif` + fi code=$? if [ "$code" == "0" ]; then debug $output @@ -73,10 +85,6 @@ if [ "$ldif" == "yes" ]; then warning $output warning "Failed ldif export of $dbsuffix" fi - if [ "$compress" == "yes" ]; then - output=`$GZIP -f "$dumpdir/$dbsuffix.ldif" 2>&1` - debug $output - fi if [ "$restart" == "yes" ]; then debug "Starting ldap server..."