From: Micah Anderson Date: Sat, 10 Jun 2006 00:33:51 +0000 (+0000) Subject: add in-line compression to ldap handler X-Git-Tag: backupninja-0.9.4~36 X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fbackupninja.git;a=commitdiff_plain;h=fe7ee521a660ef38e5657c31eefb14b95f22827f add in-line compression to ldap handler --- diff --git a/ChangeLog b/ChangeLog index 09f0d0c..7e97015 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,13 +15,13 @@ version 0.9.4 -- unreleased . Fixed erroneous removal of tmpfile when it didn't exit . Fixed inversed vsname emptiness check . Fixed su quote usage to be more posixy - . compress for sqldumps now happens in-line to save some disk space (Closes: #370778) + . Compress for sqldumps now happens in-line to save some disk space (Closes: #370778) pgsql: . Fixed inversed vsname emptiness check . Fixed su quote usage to be more posixy . Fixed shell expansion, thanks Thomas Kotzian (Closes: #363297) . postgres user UID is now the one from inside the vserver if necessary - . compress now happens in-line to save some disk space (Closes: #370778) + . Compress now happens in-line to save some disk space (Closes: #370778) svn: . Fixed inversed vsname emptiness check rdiff: @@ -43,6 +43,8 @@ version 0.9.4 -- unreleased . Now forbid to (try to) include /. sys: . Many more system checks were added, thanks to Petr KlĂ­ma + ldap: + . Compress now happens in-line to save some disk space (Closes: #370778) lib changes vserver: . init_vservers: fixed Debian bug #351083 (improper readlink syntax) 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..."