-
- if [ "$restart" == "yes" ]; then
- debug "Starting ldap server..."
- /etc/init.d/slapd start
+ if [ ! $test ]; then
+ if [ "$restart" == "yes" ]; then
+ debug "Shutting down ldap server..."
+ $vexec /etc/init.d/slapd stop
+ fi
+
+ ext=
+ if [ "$compress" == "yes" ]; then
+ ext=".gz"
+ fi
+ touch "$dumpdir/$dbsuffix.ldif$ext"
+ if [ ! -f "$dumpdir/$dbsuffix.ldif$ext" ]; then
+ fatal "Couldn't create ldif dump file: $dumpdir/$dbsuffix.ldif$ext"
+ fi
+
+ if [ "$compress" == "yes" ]; then
+ execstr="$execstr | $GZIP > \"$dumpdir/$dbsuffix.ldif.gz\""
+ else
+ execstr="$execstr > \"$dumpdir/$dbsuffix.ldif\""
+ fi
+ # Run inside the vserver if needed
+ execstr="$vexec $execstr"
+ debug "$execstr"
+ output=`su root -c "$execstr" 2>&1`
+ code=$?
+ if [ "$code" == "0" ]; then
+ debug $output
+ info "Successfully finished ldif export of $dbsuffix"
+ else
+ warning $output
+ warning "Failed ldif export of $dbsuffix"
+ fi
+
+ if [ "$restart" == "yes" ]; then
+ debug "Starting ldap server..."
+ $vexec /etc/init.d/slapd start
+ fi