From af637b047b9c35684a02f35665e8a2af02a29f61 Mon Sep 17 00:00:00 2001 From: vlad11 Date: Fri, 13 Jan 2023 18:57:18 +0200 Subject: [PATCH] Removed the check for the existence of the mail client binary if the script does not use mail notification. Signed-off-by: vlad11 --- domain-check-2.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/domain-check-2.sh b/domain-check-2.sh index 69758aa..9a5dd55 100644 --- a/domain-check-2.sh +++ b/domain-check-2.sh @@ -6,11 +6,14 @@ # Author: Matty < matty91 at gmail dot com > # Co-author: Vladislav V. Prodan # -# Current Version: 2.62 -# Last Updated: 05-Jan-2023 +# Current Version: 2.63 +# Last Updated: 13-Jan-2023 # # Revision History: # +# Version 2.63 +# Removed the check for the existence of the mail client binary if the script does not use mail notification. +# # Version 2.62 # Added support for .bm domain -- Vladislav V. Prodan # @@ -354,7 +357,7 @@ VERBOSE="FALSE" WHOIS_SERVER="whois.iana.org" # Location of system binaries -for BINARY in whois date mail curl ; do +for BINARY in whois date curl ; do if [ ! -x "$(command -v $BINARY)" ]; then echo "ERROR: The $BINARY binary does not exist in \$$BINARY." echo " FIX: Please modify the \$$BINARY variable in the program header." @@ -368,7 +371,6 @@ DATE=$(command -v date) CUT=$(command -v cut) GREP=$(command -v grep) TR=$(command -v tr) -MAIL=$(command -v mail) CURL=$(command -v curl) ECHO=$(command -v echo) HEAD=$(command -v head) @@ -1118,6 +1120,20 @@ do esac done +### Checking for the existence of a mail client +if [ "${ALARM}" == "TRUE" ] +then + for BINARY in mail ; do + if [ ! -x "$(command -v mail)" ]; then + echo "ERROR: The $BINARY binary does not exist in \$$BINARY." + echo " FIX: Please modify the \$$BINARY variable in the program header." + exit 1 + fi + done + MAIL=$(command -v mail) +fi + + ### Show debug information when running script if [ "${VERBOSE}" == "TRUE" ] then