added in sed to add the smartctl include path

This commit is contained in:
2021-02-26 11:17:54 -05:00
parent 62bd6a4860
commit d562826c56

View File

@@ -110,6 +110,10 @@ if [ $(grep -c "^Server=127.0.0.1" /etc/zabbix/zabbix_agentd.conf) -eq 1 ]; then
# ask for the hostname
read -e -p "Enter Hostname: " -i "$(cat /etc/hostname)" hostname
# set the include to add the smartctl config directory
# sed --in-place $'s/^# Hostname=/# Hostname=\\\nHostname='${hostname}'/' /etc/zabbix/zabbix_agentd.conf
sed --in-place $'s/^Include=\/etc\/zabbix\/zabbix_agentd.conf.d\/\*.conf/Include=\/etc\/zabbix\/zabbix_agentd.conf.d\/\*.conf\\\nInclude=\/etc\/zabbix\/zabbix_agentd.d\/\*.conf/' /etc/zabbix/zabbix_agentd.conf
# configure the hostname, check for older config and newer config
if [ $(grep -c "^Hostname=Zabbix" /etc/zabbix/zabbix_agentd.conf) -eq 1 ]; then
sed --in-place 's/^Hostname=Zabbix\ server/Hostname='${hostname}'/' /etc/zabbix/zabbix_agentd.conf