[Pkg-openldap-devel] r686 - openldap/trunk-2.3/debian
Matthijs Mohlmann
active2-guest at costa.debian.org
Sat Jul 15 19:39:17 UTC 2006
Author: active2-guest
Date: 2006-07-15 19:39:16 +0000 (Sat, 15 Jul 2006)
New Revision: 686
Added:
openldap/trunk-2.3/debian/slapd.backup
Modified:
openldap/trunk-2.3/debian/changelog
openldap/trunk-2.3/debian/slapd.examples
Log:
* Added a backup script example.
Modified: openldap/trunk-2.3/debian/changelog
===================================================================
--- openldap/trunk-2.3/debian/changelog 2006-07-15 18:26:16 UTC (rev 685)
+++ openldap/trunk-2.3/debian/changelog 2006-07-15 19:39:16 UTC (rev 686)
@@ -25,8 +25,9 @@
* Use find in combination with mv to move an old directory away.
(Closes: #306435)
* Updated Dutch debconf translation (Closes: #365172)
+ * Added an example backup script that can be put into cron (Closes: #319477)
- -- Matthijs Mohlmann <matthijs at cacholong.nl> Sat, 15 Jul 2006 20:13:14 +0200
+ -- Matthijs Mohlmann <matthijs at cacholong.nl> Sat, 15 Jul 2006 21:36:22 +0200
openldap2.3 (2.3.24-1) unstable; urgency=low
Added: openldap/trunk-2.3/debian/slapd.backup
===================================================================
--- openldap/trunk-2.3/debian/slapd.backup 2006-07-15 18:26:16 UTC (rev 685)
+++ openldap/trunk-2.3/debian/slapd.backup 2006-07-15 19:39:16 UTC (rev 686)
@@ -0,0 +1,62 @@
+#!/bin/bash
+#
+# Backup LDAP directories
+#
+# This script can be put in cron to create backups.
+#
+# Author: Matthijs Mohlmann <matthijs at cacholong.nl>
+# Date: Sat, 15 Jul 2006 21:13:14 +0200
+# License: GPLv2
+
+# Make sure the backups are secured.
+umask 077
+
+BACKUPDIR="/var/backups/slapd"
+DEFAULTS="/etc/default/slapd"
+
+# Check if there is a directory slapd, otherwise create it.
+if [ ! -d "$BACKUPDIR" ]; then
+ mkdir -p -m 0700 "$BACKUPDIR"
+fi
+
+# Load default settings.
+if [ -e "$DEFAULTS" ]; then
+ . "$DEFAULTS"
+fi
+
+# Specify a slapd.conf if not specified.
+if [ -z "$SLAPD_CONF" ]; then
+ SLAPD_CONF="/etc/ldap/slapd.conf"
+fi
+
+# Set IFS to end of line.
+ORIGIFS=$IFS
+IFS=`echo -en "\n\b"`
+
+# Backup recursive through all configfiles all suffix's in the form:
+# suffix.ldif in /var/backups/slapd
+function backupDirectories() {
+ local conf=$1
+ local directory=""
+ local include=""
+
+ suffix=`grep "^suffix" $conf | sed -e "s/\(^suffix\s\+\|\"\|\'\)//g"`
+ for directory in "$suffix"; do
+ if [ ! -z "$suffix" ]; then
+ slapcat -l "$BACKUPDIR/$suffix.ldif" -b "$suffix"
+ fi
+ done
+
+ includes=`grep "^include" $conf | awk '{print $2}'`
+ for include in $includes; do
+ backupDirectories "$include"
+ done
+}
+
+backupDirectories "$SLAPD_CONF"
+
+# Put IFS back.
+IFS=$ORIGIFS
+
+exit 0
+
Modified: openldap/trunk-2.3/debian/slapd.examples
===================================================================
--- openldap/trunk-2.3/debian/slapd.examples 2006-07-15 18:26:16 UTC (rev 685)
+++ openldap/trunk-2.3/debian/slapd.examples 2006-07-15 19:39:16 UTC (rev 686)
@@ -1,2 +1,3 @@
debian/DB_CONFIG
debian/slapd.conf
+debian/slapd.backup
More information about the Pkg-openldap-devel
mailing list