From 1f6856d43dee7b500eecf489ee96ac3c83f5b28a Mon Sep 17 00:00:00 2001 From: allan Date: Fri, 31 Oct 2025 11:02:31 +0100 Subject: [PATCH] logic changes --- mariadbinstall | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/mariadbinstall b/mariadbinstall index fe20f10..7a3f692 100755 --- a/mariadbinstall +++ b/mariadbinstall @@ -10,17 +10,16 @@ # if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo "" ; exit 1 ; fi +# +# Check if services are allready running +# +for svc in mariadb; do if systemctl is-active --quiet "$svc"; then printf "\n%s is already running, cannot continue...\n\n" "${svc^}" ; exit 1 ; fi ; done + # # Define variables # mariaconfig="/etc/mysql/mariadb.conf.d/50-server.cnf" -# -# Function to check if a service is already running or not -# -serviceyes () { printf "\n%s" $service ; printf " is already running cannot continue...\n\n"; } -servicealive () { status=$(systemctl is-active $service); if [[ "$status" == "active" ]]; then serviceyes ; exit 1; fi; } - # # Function usage # @@ -35,11 +34,6 @@ printf -- "Example:\n" printf -- " sudo ./mariadbinstall -u adminuser -p strongpass\n\n" } -# -# If MariaDB is already running then die -# -service="mariadb" ; servicealive - # # Let's go #