]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Checking existence of password files before
authorFrank Brehm <frank@brehm-online.com>
Thu, 10 Mar 2022 11:19:02 +0000 (12:19 +0100)
committerFrank Brehm <frank@brehm-online.com>
Thu, 10 Mar 2022 11:19:02 +0000 (12:19 +0100)
scripts/disabling-ldap-user

index 50e1025ad4ae20ab44f6ef9ea8d56bd5ab6231d7..18254efdc443f80d6a73c3561414aa656f28f7a9 100755 (executable)
@@ -9,7 +9,7 @@ QUIET='n'
 SIMULATE='n'
 YES="n"
 
-VERSION="1.3"
+VERSION="1.4"
 
 # console colors:
 RED=""
@@ -919,6 +919,25 @@ main() {
 
     trap cleanup_tmp_file INT TERM EXIT ABRT
 
+    empty_line
+    info "Checking existence of necessary password files ..."
+    local all_files_there="y"
+    for INSTANCE in "${USED_INSTANCES[@]}" ; do
+        BIND_PW_FILE="${BIND_PW_FILES[${INSTANCE}]}"
+        debug "Checking for '${CYAN}${BIND_PW_FILE}${NORMAL}'."
+        if [[ -f "${BIND_PW_FILE}" && -r "${BIND_PW_FILE}" ]] ; then
+            debug "Password file '${CYAN}${BIND_PW_FILE}${NORMAL}' exists and is readable."
+        else
+            error "Password file '${RED}${BIND_PW_FILE}${NORMAL}' does not exists or is not redable."
+            all_files_there="n"
+        fi
+    done
+    empty_line
+
+    if [[ "${all_files_there}" == "n" ]] ; then
+        exit 6
+    fi
+
     for USER in "${USERS[@]}" ; do
         for INSTANCE in "${USED_INSTANCES[@]}" ; do
             LDAP_URL="${LDAP_URLS[${INSTANCE}]}"