Author: coudot
Date: 2010-05-04 12:07:56 +0200 (Tue, 04 May 2010)
New Revision: 72
Modified:
openldap-initscript/trunk/slapd
openldap-initscript/trunk/slapd.default
openldap-initscript/trunk/slapd.default.DEBIAN
Log:
#208: compression possibility for LDIF save
Modified: openldap-initscript/trunk/slapd
===================================================================
--- openldap-initscript/trunk/slapd 2010-05-04 10:06:44 UTC (rev 71)
+++ openldap-initscript/trunk/slapd 2010-05-04 10:07:56 UTC (rev 72)
@@ -45,6 +45,11 @@
#====================================================================
# Changelog
#====================================================================
+# Version 1.0
+# - Possibility to compress saved files
+# Author: Clement OUDOT (LTB-project)
+# Author:
+#
# Version 0.9 (10/2009)
# - Get conf values from file or back-config
# - Change parameter name relative to slurpd
@@ -168,6 +173,8 @@
BACKUP_PATH="/tmp/openldap"
BACKUP_FILE="$BACKUP_PATH/data_`date +%Y%m%d%H%M%S`.ldif"
BACKUP_SUFFIX="`date +%Y%m%d%H%M%S`.ldif"
+BACKUP_COMPRESS_EXT="" # gz, bz2, ...
+BACKUP_COMPRESS_BIN="" # /bin/gzip, /bin/bzip2, ...
# Other
TIMEOUT="60" # Max time to stop process
@@ -929,14 +936,33 @@
fi
# alert
- if [ $? -eq 0 ]
+ if [ $? -ne 0 ]
then
- message "info" "[OK] data save in $file"
- else
message "alert" "[ALERT] OpenLDAP database backup
failed"
exit 1
fi
+ # compress
+ if [ -z $BACKUP_COMPRESS_EXT ]
+ then
+ message "info" "[OK] data saved in $file"
+ else
+ if [ -z "$SU" ]
+ then
+ $BACKUP_COMPRESS_BIN "$file"
+ else
+ $SU "$BACKUP_COMPRESS_BIN $file"
+ fi
+
+ # alert
+ if [ $? -ne 0 ]
+ then
+ message "alert" "[ALERT] OpenLDAP database
backup compression failed"
+ exit 1
+ fi
+ message "info" "[OK] data saved in
${file}.$BACKUP_COMPRESS_EXT"
+ fi
+
i=`expr $i + 1`
done
Modified: openldap-initscript/trunk/slapd.default
===================================================================
--- openldap-initscript/trunk/slapd.default 2010-05-04 10:06:44 UTC (rev 71)
+++ openldap-initscript/trunk/slapd.default 2010-05-04 10:07:56 UTC (rev 72)
@@ -40,6 +40,8 @@
BACKUP_PATH="$SLAPD_PATH/var/save"
BACKUP_FILE="$BACKUP_PATH/data_`date +%Y%m%d%H%M%S`.ldif"
BACKUP_SUFFIX="`date +%Y%m%d%H%M%S`.ldif"
+BACKUP_COMPRESS_EXT="" # gz, bz2, ...
+BACKUP_COMPRESS_BIN="" # /bin/gzip, /bin/bzip2, ...
# Other
TIMEOUT="30" # Max time to stop process
Modified: openldap-initscript/trunk/slapd.default.DEBIAN
===================================================================
--- openldap-initscript/trunk/slapd.default.DEBIAN 2010-05-04 10:06:44 UTC
(rev 71)
+++ openldap-initscript/trunk/slapd.default.DEBIAN 2010-05-04 10:07:56 UTC
(rev 72)
@@ -40,6 +40,8 @@
BACKUP_PATH="$SLAPD_PATH/var/save"
BACKUP_FILE="$BACKUP_PATH/data_`date +%Y%m%d%H%M%S`.ldif"
BACKUP_SUFFIX="`date +%Y%m%d%H%M%S`.ldif"
+BACKUP_COMPRESS_EXT="" # gz, bz2, ...
+BACKUP_COMPRESS_BIN="" # /bin/gzip, /bin/bzip2, ...
# Other
TIMEOUT="30" # Max time to stop process
_______________________________________________
ltb-changes mailing list
[email protected]
http://lists.ltb-project.org/listinfo/ltb-changes