Monday, July 29, 2013

slapit

some days you need to build a slap server from scratch on ubuntu 12.04 using an existing ldif.

it is a given that you've pre-pop'd all with the correct stuff in /etc/default/ldap and in /etc/ldap , too. i like to keep a copy of DB_CONFIG around, because it is nifty.
slapit.sh
#!/bin/bash

TIMESTAMP=$(date '+%Y%m%d%H%M')
BACKUPDIR=/nfs/export

/etc/init.d/slapd stop ;
mv /var/lib/ldap /var/lib/ldap-$TIMESTAMP ;
mkdir /var/lib/ldap ;
cp /etc/ldap/DB_CONFIG /var/lib/ldap ;
slapadd -c -l /tmp/$BACKUPDIR/backup.ldif ;
chown -R openldap.openldap /var/lib/ldap ;
/etc/init.d/slapd start
DB_CONFIG
set_cachesize 0 2097152 0
set_lk_max_objects 1500
set_lk_max_locks 1500
set_lk_max_lockers 1500

No comments: