From deb8e5c496fe5d5d1634dd9847a0fdb8e1a62afd Mon Sep 17 00:00:00 2001 From: Christoph Date: Sat, 13 Feb 2021 03:23:56 +0100 Subject: [PATCH] get_apache2_info.sh: add apache version. --- get_apache2_info.sh | 89 +++++++++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 35 deletions(-) diff --git a/get_apache2_info.sh b/get_apache2_info.sh index 08a672e..17e536c 100755 --- a/get_apache2_info.sh +++ b/get_apache2_info.sh @@ -242,6 +242,15 @@ else fi +echononl "Determin Apache2 version number.." +APACHE_VERSION="$(trim $($HTTPD_COMMAND -v | head -1 | cut -d ":" -f2))" +if [[ $? -gt 0 ]]; then + echo_failed +else + echo_done +fi + + echononl "Determin ServerRoot Directory.." APACHE_SERVER_ROOT="$($_httpd_binary -t -D DUMP_RUN_CFG | grep ServerRoot | awk '{print$2}' | tr -d '"')" if [[ $? -gt 0 ]]; then @@ -264,12 +273,16 @@ else fi -echononl "Determin Apache2 version number.." -APACHE_VERSION="$(trim $($HTTPD_COMMAND -v | head -1 | cut -d ":" -f2))" -if [[ $? -gt 0 ]]; then - echo_failed -else +echononl "Determin VHost directory.." +if [[ -d "${APACHE_SERVER_ROOT}/sites-enabled" ]]; then + APACHE_VHOST_DIR="${APACHE_SERVER_ROOT}/sites-enabled" +elif [[ -d "${APACHE_SERVER_ROOT}/conf/vhosts" ]]; then + APACHE_VHOST_DIR="${APACHE_SERVER_ROOT}/conf/vhosts" +fi +if [[ -n "${APACHE_VHOST_DIR}" ]] ; then echo_done +else + echo_failed fi @@ -279,38 +292,44 @@ if $terminal ; then echo -e "\033[4G\033[33m\033[1mApache2 Info:\033[m" echo -e "\033[4G\033[33m\033[1m=============\033[m" echo "" -fi - -if [[ -n $APACHE_VERSION ]]; then - echo -e "\033[4GApache2 version..................: $APACHE_VERSION" -else - echo -e "\033[4GApache2 version..................: \033[33m-- could not be determined --\033[m" -fi -echo "" -if [[ -x "$HTTPD_COMMAND" ]] ; then - echo -e "\033[4GApache2 daemon ..................: $HTTPD_COMMAND" -else - echo -e "\033[4GApache2 daemon ..................: \033[33m-- could not be determined --\033[m" -fi -echo "" -if [[ -n "$APACHE_SERVER_ROOT" ]] ; then - echo -e "\033[4GServer Root Directory............: $APACHE_SERVER_ROOT" -else - echo "\033[4GServer Root Directory............: \033[33m-- could not be determined --\033[m" -fi -echo "" -if [[ -n "$HTTP_USER" ]] ; then - echo -e "\033[4GApache2 User.....................: $HTTP_USER" -else - echo -e "\033[4GApache2 User.....................: \033[33m-- could not be determined --\033[m" -fi -if [[ -n "$HTTP_GROUP" ]] ; then - echo -e "\033[4GApache2 Group....................: $HTTP_GROUP" -else - echo -e "\033[4GApache2 Group....................: \033[33m-- could not be determined --\033[m" -fi + if [[ -n $APACHE_VERSION ]]; then + echo -e "\033[4GApache2 version..................: $APACHE_VERSION" + else + echo -e "\033[4GApache2 version..................: \033[33m-- could not be determined --\033[m" + fi + echo "" + if [[ -n "$APACHE_SERVER_ROOT" ]] ; then + echo -e "\033[4GServer Root Directory............: $APACHE_SERVER_ROOT" + else + echo "\033[4GServer Root Directory............: \033[33m-- could not be determined --\033[m" + fi + echo "" + if [[ -x "$HTTPD_COMMAND" ]] ; then + echo -e "\033[4GApache2 daemon ..................: $HTTPD_COMMAND" + else + echo -e "\033[4GApache2 daemon ..................: \033[33m-- could not be determined --\033[m" + fi + echo "" + if [[ -n "${APACHE_VHOST_DIR}" ]] ; then + echo -e "\033[4GApache2 VHost directory..........: $APACHE_VHOST_DIR" + else + echo -e "\033[4GApache2 VHost directory..........: \033[33m-- could not be determined --\033[m" + fi + echo "" + if [[ -n "$HTTP_USER" ]] ; then + echo -e "\033[4GApache2 User.....................: $HTTP_USER" + else + echo -e "\033[4GApache2 User.....................: \033[33m-- could not be determined --\033[m" + fi + if [[ -n "$HTTP_GROUP" ]] ; then + echo -e "\033[4GApache2 Group....................: $HTTP_GROUP" + else + echo -e "\033[4GApache2 Group....................: \033[33m-- could not be determined --\033[m" + fi +fi +