On 7/22/2005 9:03 AM, Torsten Landschoff wrote:
> Hi Rupa, 
> 
> On Fri, Jul 22, 2005 at 05:33:15AM -0700, Rupa Schomaker wrote:
> 
>>db got corrupted somehow (different problem for a different day) so went
>>to /var/backups to grab the last exprot to ldiff and could not find one
>>that was recent.  
>>
>>On further investigation, /etc/cron.daily/ldap bails out early if using
>>the bdb backend.  Simple patch:
> 
> 
> I am very sorry. The slapd package does not contain /etc/cron.daily/ldap
> so you probably fixed a script created by another local admin ;)

Wow. Huh, didn't follow the system's convention for marking local
additions.  Sorry for the noise.

The script is below, it must have been a sample from somewhere.

#!/bin/bash -e
#
# You can use this by editing the fields below and copying this file to
# /etc/cron.weekly/slapd
#

# make sure the backups are secured
umask 077

BACKUP_DIR=/var/backups

test -f /etc/ldap/slapd.conf || exit 0

LDAP_DB_DIRS=$(grep ^directory /etc/ldap/slapd.conf | awk '{print $2}' | \
        sed -e s,'"',,g)

test x${LDAP_DB_DIRS} != x || exit 0

echo "LDAP Directory backups..."
echo

for dir in ${LDAP_DB_DIRS}; do
        test -f ${dir}/id2entry.[bd][db]b || continue
        echo -n "  $dir ... "
        backname=${BACKUP_DIR}/$(echo $dir | sed -e s,/,_,g -e s,^_,,g)
        if [ -f ${backname}.ldif ]; then
                savelog ${backname}.ldif
        fi
        count=$(slapcat -n 1 | tee ${backname}.ldif | grep '^dn: ' | wc
-l | awk '{print $1}')
        echo -n "done, "
        echo "$count entries."
done

echo
echo "Backups complete."


> 
> Greetings
> 
>       Torsten

-- 
 -Rupa

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to