ldap_server: ShellCheck fixes and more strict shell opts

This commit is contained in:
Timo Makinen 2022-10-31 01:31:39 +00:00
parent e25d100c06
commit 3e216a2d30

View file

@ -1,4 +1,6 @@
#!/bin/bash
#!/bin/sh
set -eu
umask 027
@ -16,7 +18,7 @@ DATE="$(date '+%Y-%m-%d')"
ldapsearch -LLL -x -H ldapi:// -s base -b 'cn=Databases,cn=Monitor' \
'(objectClass=*)' namingContexts | \
sed -n 's/^namingContexts: \(.*\)/\1/p' | while read db ; do
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