/usr/share/doc/slapd/examples/slapd.backup is in slapd 2.4.40+dfsg-1+deb8u4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #!/bin/bash
#
# Backup LDAP directories
#
# This script can be put in cron to create backups.
#
# Author: Matthijs Mohlmann <matthijs@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
|