fix error determin configuration file.

This commit is contained in:
Christoph 2023-08-04 01:39:40 +02:00
parent 2f8d771420
commit 588eb68502
5 changed files with 87 additions and 53 deletions

View File

@ -133,13 +133,11 @@ error(){
} }
warn (){ warn (){
echo ""
if $terminal ; then if $terminal ; then
echo ""
echo -e " [ \033[33m\033[1mWarning\033[m ]: $*" echo -e " [ \033[33m\033[1mWarning\033[m ]: $*"
else echo ""
echo " [ Warning ]: $*"
fi fi
echo ""
} }
info (){ info (){
@ -174,6 +172,14 @@ blank_line() {
} }
# - Running in a terminal?
# -
if [[ -t 1 ]] ; then
terminal=true
else
terminal=false
fi
# ---------- # ----------
# - Jobhandling # - Jobhandling
@ -214,6 +220,17 @@ if [[ -z "$WEBSITE" ]] ; then
# #
source ${snippet_dir}/get-cloud-instance-to-update.sh source ${snippet_dir}/get-cloud-instance-to-update.sh
else
while IFS='' read -r -d '' _conf_file ; do
if $(grep -E -q "WEBSITE=\"?${WEBSITE}\"?" ${_conf_file} 2> /dev/null) ; then
conf_file="${_conf_file}"
break
fi
done < <(find "${conf_dir}" -maxdepth 1 -type f -name "*.conf" -print0)
# conf_file="${conf_dir}/${WEBSITE}.conf"
fi fi
@ -227,7 +244,7 @@ DEFAULT_HTTP_GROUP="www-data"
DEFAULT_PHP_ENGINE='FPM' DEFAULT_PHP_ENGINE='FPM'
echo "" echo ""
echononl " Include Configuration file.." echononl " Include Configuration file '$(basename "${conf_file}")'.."
if [[ ! -f $conf_file ]]; then if [[ ! -f $conf_file ]]; then
echo_failed echo_failed
fatal "Missing configuration file '$conf_file'." fatal "Missing configuration file '$conf_file'."
@ -264,14 +281,6 @@ else
SYSTEMD_EXISTS=true SYSTEMD_EXISTS=true
fi fi
# - Running in a terminal?
# -
if [[ -t 1 ]] ; then
terminal=true
else
terminal=false
fi
#clear #clear
if $terminal ; then if $terminal ; then

View File

@ -140,13 +140,11 @@ error(){
} }
warn (){ warn (){
echo ""
if $terminal ; then if $terminal ; then
echo ""
echo -e " [ \033[33m\033[1mWarning\033[m ]: $*" echo -e " [ \033[33m\033[1mWarning\033[m ]: $*"
else echo ""
echo " [ Warning ]: $*"
fi fi
echo ""
} }
info (){ info (){
@ -181,6 +179,14 @@ blank_line() {
} }
# - Running in a terminal?
# -
if [[ -t 1 ]] ; then
terminal=true
else
terminal=false
fi
# ---------- # ----------
# - Jobhandling # - Jobhandling
@ -221,6 +227,15 @@ if [[ -z "$WEBSITE" ]] ; then
# #
source ${snippet_dir}/get-cloud-instance-to-update.sh source ${snippet_dir}/get-cloud-instance-to-update.sh
else
while IFS='' read -r -d '' _conf_file ; do
if $(grep -E -q "WEBSITE=\"?${WEBSITE}\"?" ${_conf_file} 2> /dev/null) ; then
conf_file="${_conf_file}"
break
fi
done < <(find "${conf_dir}" -maxdepth 1 -type f -name "*.conf" -print0)
# conf_file="${conf_dir}/${WEBSITE}.conf"
fi fi
@ -234,7 +249,7 @@ DEFAULT_HTTP_GROUP="www-data"
DEFAULT_PHP_ENGINE='FPM' DEFAULT_PHP_ENGINE='FPM'
echo "" echo ""
echononl " Include Configuration file.." echononl " Include Configuration file '$(basename "${conf_file}")'.."
if [[ ! -f $conf_file ]]; then if [[ ! -f $conf_file ]]; then
echo_failed echo_failed
fatal "Missing configuration file '$conf_file'." fatal "Missing configuration file '$conf_file'."
@ -271,14 +286,6 @@ else
SYSTEMD_EXISTS=true SYSTEMD_EXISTS=true
fi fi
# - Running in a terminal?
# -
if [[ -t 1 ]] ; then
terminal=true
else
terminal=false
fi
#clear #clear
if $terminal ; then if $terminal ; then

View File

@ -226,15 +226,17 @@ if [[ -z "$WEBSITE" ]] ; then
# #
source ${snippet_dir}/get-cloud-instance-to-update.sh source ${snippet_dir}/get-cloud-instance-to-update.sh
#fatal "No website ios given on commandline - Missing Parameter '-s <website>'"
else else
while IFS='' read -r -d '' _conf_file ; do while IFS='' read -r -d '' _conf_file ; do
if $(grep -E -q "WEBSITE=\"?${WEBSITE}\"?" ${_conf_file} 2> /dev/null) ; then if $(grep -E -q "WEBSITE=\"?${WEBSITE}\"?" ${_conf_file} 2> /dev/null) ; then
conf_file="${_conf_file}" conf_file="${_conf_file}"
break break
fi fi
done < <(find "${conf_dir}" -maxdepth 1 -type f -name "*.conf" -print0) done < <(find "${conf_dir}" -maxdepth 1 -type f -name "*.conf" -print0)
# conf_file="${conf_dir}/${WEBSITE}.conf" # conf_file="${conf_dir}/${WEBSITE}.conf"
fi fi

View File

@ -139,13 +139,11 @@ error(){
} }
warn (){ warn (){
echo ""
if $terminal ; then if $terminal ; then
echo ""
echo -e " [ \033[33m\033[1mWarning\033[m ]: $*" echo -e " [ \033[33m\033[1mWarning\033[m ]: $*"
else echo ""
echo " [ Warning ]: $*"
fi fi
echo ""
} }
info (){ info (){
@ -180,6 +178,14 @@ blank_line() {
} }
# - Running in a terminal?
# -
if [[ -t 1 ]] ; then
terminal=true
else
terminal=false
fi
# ---------- # ----------
# - Jobhandling # - Jobhandling
@ -220,7 +226,16 @@ if [[ -z "$WEBSITE" ]] ; then
# #
source ${snippet_dir}/get-cloud-instance-to-update.sh source ${snippet_dir}/get-cloud-instance-to-update.sh
#fatal "No website ios given on commandline - Missing Parameter '-s <website>'" else
while IFS='' read -r -d '' _conf_file ; do
if $(grep -E -q "WEBSITE=\"?${WEBSITE}\"?" ${_conf_file} 2> /dev/null) ; then
conf_file="${_conf_file}"
break
fi
done < <(find "${conf_dir}" -maxdepth 1 -type f -name "*.conf" -print0)
# conf_file="${conf_dir}/${WEBSITE}.conf"
fi fi
@ -271,14 +286,6 @@ else
SYSTEMD_EXISTS=true SYSTEMD_EXISTS=true
fi fi
# - Running in a terminal?
# -
if [[ -t 1 ]] ; then
terminal=true
else
terminal=false
fi
#clear #clear
if $terminal ; then if $terminal ; then

View File

@ -139,13 +139,11 @@ error(){
} }
warn (){ warn (){
echo ""
if $terminal ; then if $terminal ; then
echo ""
echo -e " [ \033[33m\033[1mWarning\033[m ]: $*" echo -e " [ \033[33m\033[1mWarning\033[m ]: $*"
else echo ""
echo " [ Warning ]: $*"
fi fi
echo ""
} }
info (){ info (){
@ -180,6 +178,14 @@ blank_line() {
} }
# - Running in a terminal?
# -
if [[ -t 1 ]] ; then
terminal=true
else
terminal=false
fi
# ---------- # ----------
# - Jobhandling # - Jobhandling
@ -221,6 +227,17 @@ if [[ -z "$WEBSITE" ]] ; then
# #
source ${snippet_dir}/get-cloud-instance-to-update.sh source ${snippet_dir}/get-cloud-instance-to-update.sh
else
while IFS='' read -r -d '' _conf_file ; do
if $(grep -E -q "WEBSITE=\"?${WEBSITE}\"?" ${_conf_file} 2> /dev/null) ; then
conf_file="${_conf_file}"
break
fi
done < <(find "${conf_dir}" -maxdepth 1 -type f -name "*.conf" -print0)
# conf_file="${conf_dir}/${WEBSITE}.conf"
fi fi
@ -234,7 +251,7 @@ DEFAULT_HTTP_GROUP="www-data"
DEFAULT_PHP_ENGINE='FPM' DEFAULT_PHP_ENGINE='FPM'
echo "" echo ""
echononl " Include Configuration file.." echononl " Include Configuration file.. '$(basename "${conf_file}")'"
if [[ ! -f $conf_file ]]; then if [[ ! -f $conf_file ]]; then
echo_failed echo_failed
fatal "Missing configuration file '$conf_file'." fatal "Missing configuration file '$conf_file'."
@ -271,14 +288,6 @@ else
SYSTEMD_EXISTS=true SYSTEMD_EXISTS=true
fi fi
# - Running in a terminal?
# -
if [[ -t 1 ]] ; then
terminal=true
else
terminal=false
fi
#clear #clear
if $terminal ; then if $terminal ; then