diff --git a/plugins/localdump/ldap.sh b/plugins/localdump/ldap.sh
index 5df9f03142119e0928ac960c60cc675c371f53c7..0f366b7f9f8e00b382f5071b1fc5e3af96f53b1e 100755
--- a/plugins/localdump/ldap.sh
+++ b/plugins/localdump/ldap.sh
@@ -8,8 +8,9 @@
 # Author: daniel.schueler@iml.unibe.ch
 # Location: /root/bin/backup_ldap.sh
 #
-# This script is called by Cron and controlled by Puppet.
-# --> Do not edit manualy!
+# --------------------------------------------------------------------------------
+# 2021-12-13  .....  v1.0  detect config path
+# 2021-12-13  ah     v1.0  detect config path
 # ================================================================================
 
 
@@ -25,7 +26,13 @@ fi
 
 
 SLAPCAT='/sbin/slapcat'
-LDAP_CONF_DIR_PATH='/etc/openldap/slapd.d'
+
+# detect config path
+LDAP_CONF_DIR_PATH=/something/unknown
+for mydir in /etc/openldap/slapd.d /etc/ldap/slapd.d
+do
+  test -d $mydir && LDAP_CONF_DIR_PATH=$mydir
+done
 
 
 # --------------------------------------------------------------------------------
@@ -45,7 +52,7 @@ function dump_ldap(){
   fetchrc
 
   if [ $rc -ne 0 ]; then
-    echo ERROR during backup $LDAP_CONF_DIR_PATH
+    echo ERROR during backup $LDAP_CONF_DIR_PATH with DN $DN
   else
     echo Dump OK
     compress_file $DUMPFILE
@@ -60,7 +67,8 @@ function doLdapBackup(){
   create_targetdir
 
   echo ----- LDAP BACKUP CONFIG
-  for cfgname in `ldapsearch -H ldap:// -x -s base -b "" -LLL "configContext" | grep "configContext" | cut -f 2 -d ":"`
+  # for cfgname in `ldapsearch -H ldap:// -x -s base -b "" -LLL "configContext" | grep "configContext" | cut -f 2 -d ":"`
+  for cfgname in `ldapsearch -Y EXTERNAL -H ldapi:///  -s base -b '' -LLL configContext | grep "configContext" | cut -f 2 -d ":"`
   do
     echo DN $cfgname
     cfg2=`echo $cfgname | sed "s#[\ =,]#_#g"`
@@ -71,7 +79,8 @@ function doLdapBackup(){
 
 
   echo ----- LDAP DATA
-  for cfgname in `ldapsearch -H ldap:// -x -s base -b "" -LLL "namingContexts" | grep "namingContexts" | cut -f 2 -d ":"`
+  #for cfgname in `ldapsearch -H ldap:// -x -s base -b "" -LLL "namingContexts" | grep "namingContexts" | cut -f 2 -d ":"`
+  for cfgname in `ldapsearch -Y EXTERNAL -H ldapi:/// -s base -b "" -LLL "namingContexts" | grep "namingContexts" | cut -f 2 -d ":"`
   do
     echo DN $cfgname
     cfg2=`echo $cfgname | sed "s#[\ =,]#_#g"`
@@ -103,6 +112,7 @@ j_requireBinary "slapcat"    1
 
 j_requireProcess "slapd"     1
 
+ls $LDAP_CONF_DIR_PATH >/dev/null
 
 if [ $rc -ne 0 ]; then
   rc=0