ldap_server: Style fixes for backup script
This commit is contained in:
parent
750b3bab7d
commit
0eeed22092
1 changed files with 8 additions and 7 deletions
|
@ -16,19 +16,20 @@ BACKUPAGE="30"
|
|||
|
||||
DATE="$(date '+%Y-%m-%d')"
|
||||
|
||||
cd "$BACKUPDIR"
|
||||
|
||||
ldapsearch -LLL -x -H ldapi:// -s base -b 'cn=Databases,cn=Monitor' \
|
||||
'(objectClass=*)' namingContexts | \
|
||||
sed -n 's/^namingContexts: \(.*\)/\1/p' | while read -r db ; do
|
||||
[ "${db}" = "cn=config" ] && continue
|
||||
if ! slapcat -f /etc/openldap/slapd.conf -b "${db}" 2> /dev/null | \
|
||||
gzip > "${BACKUPDIR}/${db}.${DATE}.gz" ; then
|
||||
[ "$db" = "cn=config" ] && continue
|
||||
if ! slapcat -f /etc/openldap/slapd.conf -b "$db" 2> /dev/null | \
|
||||
gzip > "${db}.${DATE}.gz"
|
||||
then
|
||||
echo "ERR: Failed to backup database ${db}" 1>&2
|
||||
continue
|
||||
fi
|
||||
chgrp backup "${BACKUPDIR}/${db}.${DATE}.gz"
|
||||
done
|
||||
|
||||
cd ${BACKUPDIR} && {
|
||||
find . -xdev -depth -mindepth 1 -maxdepth 1 -type f -mtime +${BACKUPAGE} \
|
||||
-name '*.gz' -execdir rm -f -- {} \;
|
||||
}
|
||||
find . -xdev -depth -mindepth 1 -maxdepth 1 -type f -mtime +${BACKUPAGE} \
|
||||
-name '*.gz' -execdir rm -f -- {} \;
|
||||
|
|
Loading…
Add table
Reference in a new issue