summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-14 14:42:12 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-14 14:42:12 (GMT)
commiteb1c7cff78f3e3267617cd536809467d246ceff5 (patch)
tree66d532e1433831edeb7e8583fd1f444954ea2186
parented30bbeba26b0c39f075a4d10c9d38869cf9b123 (diff)
downloadkolab-scripts-eb1c7cff78f3e3267617cd536809467d246ceff5.tar.gz
Add a backup script for 389ds
-rwxr-xr-xutils/backup-389ds11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/backup-389ds b/utils/backup-389ds
new file mode 100755
index 0000000..40dd6f4
--- /dev/null
+++ b/utils/backup-389ds
@@ -0,0 +1,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