diff --git a/README.md b/README.md index ae33665..f6bf187 100644 --- a/README.md +++ b/README.md @@ -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) 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 can be found on [\[wiki.x-files.dk\]](https://wiki.x-files.dk) diff --git a/zabbixinstall b/zabbixinstall index dfd7290..391ffc6 100755 --- a/zabbixinstall +++ b/zabbixinstall @@ -34,6 +34,7 @@ printf -- "zabbixinstall \n\n" printf -- "Usage: \n" printf -- "./zabbixinstall [-n] \n" printf -- " [-p] \n" +printf -- " [-r] \n" printf -- " [-help] \n\n" printf -- "Examples: \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 () { 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 # @@ -59,11 +61,12 @@ clear ; title # # 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 n) # hostname @@ -72,6 +75,9 @@ while getopts "n:p:h:" option; do p) # database password zabbixpwd=$OPTARG;; + r) # database password + mariadbpwd=$OPTARG;; + h) # display help usage ; exit;; @@ -82,7 +88,7 @@ done # # Check if input conditions are met # -inputcheck "$hostname" "$zabbixpwd" +inputcheck "$hostname" "$zabbixpwd" "$mariadbpwd" # # Install the Zabbix repository # @@ -110,7 +116,7 @@ set global log_bin_trust_function_creators = 1; FLUSH PRIVILEGES; " printf '%s\n' "${zabbixsql[@]}" |sed '1d; $d' > zabbixsql.sql -mysql < zabbixsql.sql +mysql -u root -p"$mariadbpwd" < zabbixsql.sql # # Import Zabbix database shema #