Adjust script 'get_sites_with_external_nameservers.sh'.

This commit is contained in:
Christoph 2021-08-12 11:28:26 +02:00
parent bc6f974615
commit b649ca58a1

View File

@ -162,6 +162,29 @@ blank_line() {
fi fi
} }
## - quicksorts positional arguments
## - return is in array qsort_ret
qsort() {
local pivot i smaller=() larger=()
qsort_ret=()
(($#==0)) && return 0
pivot=$1
shift
for i; do
if [[ $i < $pivot ]]; then
smaller+=( "$i" )
else
larger+=( "$i" )
fi
done
qsort "${smaller[@]}"
smaller=( "${qsort_ret[@]}" )
qsort "${larger[@]}"
larger=( "${qsort_ret[@]}" )
qsort_ret=( "${smaller[@]}" "$pivot" "${larger[@]}" )
}
# ============= # =============
@ -445,6 +468,15 @@ if $NEED_APACHE_INFO && $terminal ; then
fi fi
if [[ -n "${APACHE_VHOST_DIR}" ]] ; then
if [[ -d "${APACHE_VHOST_DIR}/DNS-outsourced" ]] ; then
APACHE_DNS_OUTSOURCED_VHOST_DIR="${APACHE_VHOST_DIR}/DNS-outsourced"
dns_outsource_dir=true
else
dns_outsource_dir=false
fi
fi
if $terminal ; then if $terminal ; then
@ -475,6 +507,10 @@ if $terminal ; then
echo "" echo ""
if [[ -n "${APACHE_VHOST_DIR}" ]] ; then if [[ -n "${APACHE_VHOST_DIR}" ]] ; then
echo -e "\033[4GApache2 VHost directory..........: $APACHE_VHOST_DIR" echo -e "\033[4GApache2 VHost directory..........: $APACHE_VHOST_DIR"
if $dns_outsource_dir ; then
echo -e "\033[4G : $APACHE_DNS_OUTSOURCED_VHOST_DIR"
fi
else else
echo -e "\033[4GApache2 VHost directory..........: \033[33m-- could not be determined --\033[m" echo -e "\033[4GApache2 VHost directory..........: \033[33m-- could not be determined --\033[m"
fi fi
@ -548,6 +584,9 @@ else
echo "" echo ""
if [[ -n "${APACHE_VHOST_DIR}" ]] ; then if [[ -n "${APACHE_VHOST_DIR}" ]] ; then
echo " Apache2 VHost directory..........: $APACHE_VHOST_DIR" echo " Apache2 VHost directory..........: $APACHE_VHOST_DIR"
if $dns_outsource_dir ; then
echo " : $APACHE_DNS_OUTSOURCED_VHOST_DIR"
fi
else else
echo " Apache2 VHost directory..........: -- could not be determined --" echo " Apache2 VHost directory..........: -- could not be determined --"
fi fi
@ -630,10 +669,20 @@ fi
# Get list of vhost configurations # Get list of vhost configurations
# #
declare -a _tmp_arr=()
declare -a vhost_config_files_arr=() declare -a vhost_config_files_arr=()
for _file in $(ls "${APACHE_VHOST_DIR}/"*.conf) ; do for _file in $(ls "${APACHE_VHOST_DIR}/"*.conf) ; do
vhost_config_files_arr+=("$(realpath $_file)") _tmp_arr+=("$(realpath $_file)")
done done
if $dns_outsource_dir ; then
for _file in $(ls "${APACHE_DNS_OUTSOURCED_VHOST_DIR}/"*.conf) ; do
_tmp_arr+=("$(realpath $_file)")
done
fi
# sort array '_tmp_arr'
#
IFS=$'\n' vhost_config_files_arr=($(sort <<<"${_tmp_arr[*]}"))
sites_external_ns_servers=() sites_external_ns_servers=()