logic changes

This commit is contained in:
2025-10-31 11:02:31 +01:00
parent 82ba921d60
commit 1f6856d43d

View File

@@ -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
#