diff --git a/scripts/openldap b/scripts/openldap new file mode 100644 index 0000000..8468ba3 --- /dev/null +++ b/scripts/openldap @@ -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