minor changes

This commit is contained in:
allan 2025-06-02 14:35:55 +02:00
parent 47d8d4d9b7
commit 77b2cd9ca7
2 changed files with 17 additions and 7 deletions

View File

@ -39,6 +39,10 @@ and also the default "sites-enabled" Nginx configurarion I use
[\[Here\]](https://git.x-files.dk/ubuntu-web-server/nginx-install/src/branch/main/cfg/default) [\[Here\]](https://git.x-files.dk/ubuntu-web-server/nginx-install/src/branch/main/cfg/default)
when you start troubleshooting. when you start troubleshooting.
### Q and A
Q: Why does the script need the MariaDB root password ?\
A: The script need this password in order to be able to create the wordpress database and det the correct permisions.
### More guides ### More guides
More guides can be found on [\[wiki.x-files.dk\]](https://wiki.x-files.dk) More guides can be found on [\[wiki.x-files.dk\]](https://wiki.x-files.dk)

View File

@ -34,6 +34,7 @@ printf -- "zabbixinstall \n\n"
printf -- "Usage: \n" printf -- "Usage: \n"
printf -- "./zabbixinstall [-n] <zabbix domain> \n" printf -- "./zabbixinstall [-n] <zabbix domain> \n"
printf -- " [-p] <zabbix database password> \n" printf -- " [-p] <zabbix database password> \n"
printf -- " [-r] <mariadb root password> \n"
printf -- " [-help] <this screen> \n\n" printf -- " [-help] <this screen> \n\n"
printf -- "Examples: \n" printf -- "Examples: \n"
printf -- "./zabbixinstall -n zabbix.something.xyz -p zabbixdatabsepwd\n\n"; } printf -- "./zabbixinstall -n zabbix.something.xyz -p zabbixdatabsepwd\n\n"; }
@ -47,7 +48,8 @@ servicedead () { status=$(systemctl is-active $service); if [[ "$status" != "ac
# #
inputcheck () { inputcheck () {
if [[ -z "$hostname" ]]; then usage ; printf "Error! Hostname Empty...\n\n" ; exit; fi if [[ -z "$hostname" ]]; then usage ; printf "Error! Hostname Empty...\n\n" ; exit; fi
if [[ -z "$zabbixpwd" ]]; then usage ; printf "Error! Database Password Empty...\n\n" ; exit; fi; } if [[ -z "$zabbixpwd" ]]; then usage ; printf "Error! Database Password Empty...\n\n" ; exit; fi
if [[ -z "$mariadbpwd" ]]; then usage ; printf "Error! Database Password Empty...\n\n" ; exit; fi; }
# #
# If Nginx and MariaDB is not running then die # If Nginx and MariaDB is not running then die
# #
@ -59,11 +61,12 @@ clear ; title
# #
# Configure command line options # Configure command line options
# #
# Removed due to SC2199 and not really needed start
# if [[ ! $@ =~ ^\-.+ ]]; then usage; fi
# Removed due to SC2199 and not really needed stop
while getopts "n:p:h:" option; do # shellcheck disable=SC2199
# if [[ ! $@ =~ ^\-.+ ]]; then usage; fi
# shellcheck disable=SC2086
while getopts "n:p:r:h:" option; do
case $option in case $option in
n) # hostname n) # hostname
@ -72,6 +75,9 @@ while getopts "n:p:h:" option; do
p) # database password p) # database password
zabbixpwd=$OPTARG;; zabbixpwd=$OPTARG;;
r) # database password
mariadbpwd=$OPTARG;;
h) # display help h) # display help
usage ; exit;; usage ; exit;;
@ -82,7 +88,7 @@ done
# #
# Check if input conditions are met # Check if input conditions are met
# #
inputcheck "$hostname" "$zabbixpwd" inputcheck "$hostname" "$zabbixpwd" "$mariadbpwd"
# #
# Install the Zabbix repository # Install the Zabbix repository
# #
@ -110,7 +116,7 @@ set global log_bin_trust_function_creators = 1;
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
" "
printf '%s\n' "${zabbixsql[@]}" |sed '1d; $d' > zabbixsql.sql printf '%s\n' "${zabbixsql[@]}" |sed '1d; $d' > zabbixsql.sql
mysql < zabbixsql.sql mysql -u root -p"$mariadbpwd" < zabbixsql.sql
# #
# Import Zabbix database shema # Import Zabbix database shema
# #