From 8f781de0d497bad2308a1d219842f89cfdfe8aff Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Thu, 17 Oct 2019 18:23:07 -0600 Subject: [PATCH] check webroot and config dirs --- ab-nginx.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ab-nginx.sh b/ab-nginx.sh index a71f45f..f1e2aa7 100755 --- a/ab-nginx.sh +++ b/ab-nginx.sh @@ -15,6 +15,8 @@ yellow=$(tput setaf 3) ### parameter defaults container_name="ab-nginx" shell=false +unset CONFIG_DIR +unset WEBROOT_DIR scriptHelp () { @@ -93,7 +95,19 @@ if [ "$TLS13_ONLY" = FALSE ]; then fi fi +# check if specified config directory exists +if [ "$CONFIG_DIR" ] && [ ! -d "$CONFIG_DIR" ]; then + printf "${err}\nCannot find specified configuration file directory. Exiting.${norm}\n" + exit 4 +fi +# check if specified webroot directory exists +if [ "$WEBROOT_DIR" ] && [ ! -d "$WEBROOT_DIR" ]; then + printf "${err}\nCannot find specified webroot directory. Exiting.${norm}\n" + exit 4 +fi + +exit 99 # process startup parameters while [ $# -gt 0 ]; do case "$1" in