Added openldap backup agent

This commit is contained in:
Eric Renfro 2021-09-04 19:14:05 -04:00
parent e355d55402
commit 00e32f8f5e
Signed by: psi-jack
GPG Key ID: 14977F3A50D9A5BF
1 changed files with 28 additions and 0 deletions

28
scripts/openldap Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
restoreDir=/etc/restore
ldapDir="$restoreDir/openldap"
hook_check() {
if [[ -d "$ldapDir" ]]; then
rm -rf "$ldapDir" || exit 1
fi
}
hook_pre() {
hook_check
mkdir -p "$ldapDir" || exit 1
slapcat -n 0 -l "$ldapDir/config.ldif"
slapcat -n 1 -l "$ldapDir/data.ldif"
}
hook_post() {
rm -rf "$ldapDir" || exit 1
}
case "$1" in
before_check) hook_check;;
before_backup) hook_pre;;
after_backup) hook_post;;
esac