Added openldap backup agent
This commit is contained in:
parent
e355d55402
commit
00e32f8f5e
1 changed files with 28 additions and 0 deletions
28
scripts/openldap
Normal file
28
scripts/openldap
Normal 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
|
Loading…
Reference in a new issue