Skip to content
Snippets Groups Projects

ldap backup: detect sbin path to execute slapcat without path

Merged Hahn Axel (hahn) requested to merge version-2 into master
1 file
+ 9
5
Compare changes
  • Side-by-side
  • Inline
+ 9
5
@@ -9,8 +9,9 @@
@@ -9,8 +9,9 @@
# Location: /root/bin/backup_ldap.sh
# Location: /root/bin/backup_ldap.sh
#
#
# --------------------------------------------------------------------------------
# --------------------------------------------------------------------------------
# 2021-12-13 ..... v1.0 detect config path
# 202_-__-__ ..... v1.0 detect config path
# 2021-12-13 ah 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
@@ -24,8 +25,11 @@ fi
# CONFIG
# CONFIG
# --------------------------------------------------------------------------------
# --------------------------------------------------------------------------------
# detect sbin path (to execute slapcat without path)
SLAPCAT='/sbin/slapcat'
for mydir in /sbin /usr/sbin
 
do
 
test -d $mydir && export PATH=$PATH:$mydir
 
done
# detect config path
# detect config path
LDAP_CONF_DIR_PATH=/something/unknown
LDAP_CONF_DIR_PATH=/something/unknown
@@ -48,7 +52,7 @@ function dump_ldap(){
@@ -48,7 +52,7 @@ function dump_ldap(){
DN=$1
DN=$1
DUMPFILE=$2
DUMPFILE=$2
$SLAPCAT -F $LDAP_CONF_DIR_PATH -b $DN -l $DUMPFILE
slapcat -F $LDAP_CONF_DIR_PATH -b $DN -l $DUMPFILE
fetchrc
fetchrc
if [ $rc -ne 0 ]; then
if [ $rc -ne 0 ]; then
Loading