summaryrefslogtreecommitdiff
path: root/utils/backup-389ds
blob: 40dd6f40c542b4854c3705d92849f323c94aa173 (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash

if [ "$1" == "--before" ]; then
    for dir in `find /etc/dirsrv/ -mindepth 1 -maxdepth 1 -type d -name "slapd-*" | xargs -n 1 basename`; do
        for nsdb in `find /var/lib/dirsrv/${dir}/db/ -mindepth 1 -maxdepth 1 -type d | xargs -n 1 basename`; do
            ns-slapd db2ldif -D /etc/dirsrv/${dir} -n ${nsdb} -a /tmp/$(hostname)-$(echo ${dir} | sed -e 's/slapd-//g')-${nsdb}.ldif >/dev/null 2>&1
        done
    done
elif [ "$1" == "--after" ]; then
    rm -rf /tmp/*.ldif
fi