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 #