You've already forked zabbix-install
minor changes
This commit is contained in:
@@ -34,6 +34,7 @@ printf -- "zabbixinstall \n\n"
|
||||
printf -- "Usage: \n"
|
||||
printf -- "./zabbixinstall [-n] <zabbix domain> \n"
|
||||
printf -- " [-p] <zabbix database password> \n"
|
||||
printf -- " [-r] <mariadb root password> \n"
|
||||
printf -- " [-help] <this screen> \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
|
||||
#
|
||||
|
Reference in New Issue
Block a user