From 9352d242116c9718e5b85b574ba7ae50ed611813 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Tue, 14 Dec 2021 10:46:50 +0100 Subject: [PATCH] ldap backup: detect sbin path to execute slapcat without path --- plugins/localdump/ldap.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/localdump/ldap.sh b/plugins/localdump/ldap.sh index 0f366b7..bab4d9e 100755 --- a/plugins/localdump/ldap.sh +++ b/plugins/localdump/ldap.sh @@ -9,8 +9,9 @@ # Location: /root/bin/backup_ldap.sh # # -------------------------------------------------------------------------------- -# 2021-12-13 ..... v1.0 detect config path -# 2021-12-13 ah v1.0 detect config path +# 202_-__-__ ..... v1.0 detect config path +# 2021-12-13 ah v1.1 detect config path +# 2021-12-14 ah v1.2 detect sbin path to execute slapcat without path # ================================================================================ @@ -24,8 +25,11 @@ fi # CONFIG # -------------------------------------------------------------------------------- - -SLAPCAT='/sbin/slapcat' +# detect sbin path (to execute slapcat without path) +for mydir in /sbin /usr/sbin +do + test -d $mydir && export PATH=$PATH:$mydir +done # detect config path LDAP_CONF_DIR_PATH=/something/unknown @@ -48,7 +52,7 @@ function dump_ldap(){ DN=$1 DUMPFILE=$2 - $SLAPCAT -F $LDAP_CONF_DIR_PATH -b $DN -l $DUMPFILE + slapcat -F $LDAP_CONF_DIR_PATH -b $DN -l $DUMPFILE fetchrc if [ $rc -ne 0 ]; then -- GitLab