You've already forked dokuwiki-ubuntu
logic changes
This commit is contained in:
@@ -10,17 +10,22 @@
|
||||
#
|
||||
if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo "" ; exit 1 ; fi
|
||||
|
||||
#
|
||||
# Define variables and functions
|
||||
#
|
||||
hostname="$1"
|
||||
|
||||
#
|
||||
# Get php-fpm version
|
||||
#
|
||||
phpfpm=$(systemctl list-unit-files --type=service | awk '/php[0-9]+\.[0-9]+-fpm/ {sub(".service",""); print; exit}')
|
||||
if [[ -z "$phpfpm" ]]; then printf "\nUnable to detect php-fpm version. Is PHP-FPM installed?\n\n" ; exit 1 ; fi
|
||||
|
||||
#
|
||||
# Check if required services are running or not
|
||||
#
|
||||
for svc in nginx "$phpfpm"; do systemctl is-active --quiet "$svc" || { printf "\n%s is not running, cannot continue...\n\n" "${svc^}" ; exit 1 ; }; done
|
||||
|
||||
#
|
||||
# Define variables and functions
|
||||
#
|
||||
hostname="$1"
|
||||
|
||||
#
|
||||
# Function usage
|
||||
#
|
||||
@@ -33,29 +38,6 @@ usage () {
|
||||
printf -- "sudo ./dokuwikiinstall wiki.something.xyz\n\n"
|
||||
}
|
||||
|
||||
#
|
||||
# Function check if a service is running or stopped, including php-fpm
|
||||
#
|
||||
checkservice() {
|
||||
local svc="$1" ; local mode="$2"
|
||||
|
||||
if [[ "$svc" == php*-fpm ]] && ! systemctl list-unit-files --type=service | grep -q "^${svc}.service" ; then
|
||||
svc="php-fpm"
|
||||
fi
|
||||
|
||||
if [[ "$mode" == "mustberunning" ]]; then
|
||||
if ! systemctl is-active --quiet "$svc" 2>/dev/null; then
|
||||
printf "\nService %s is not running, aborting...\n\n" "$svc"
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "$mode" == "mustnotberunning" ]]; then
|
||||
if systemctl is-active --quiet "$svc" 2>/dev/null; then
|
||||
printf "\nService %s is already running, aborting...\n\n" "$svc"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Function input check
|
||||
#
|
||||
@@ -64,11 +46,6 @@ inputcheck () {
|
||||
if [[ "$1" =~ [[:space:]/] ]]; then printf "ERROR: DOMAIN INVALID (no spaces or slashes allowed)\n\n"; exit 1; fi
|
||||
}
|
||||
|
||||
#
|
||||
# If Nginx or PHP-Fpm is not running then die.
|
||||
#
|
||||
checkservice nginx mustberunning ; checkservice "$phpfpm" mustberunning
|
||||
|
||||
#
|
||||
# Let's go
|
||||
#
|
||||
@@ -160,7 +137,7 @@ EOF
|
||||
#
|
||||
# Print notice
|
||||
#
|
||||
printf '%s\n' "$wikinotice"
|
||||
printf '\n%s\n' "$wikinotice"
|
||||
|
||||
#
|
||||
# All done
|
||||
|
||||
Reference in New Issue
Block a user