2016-08-03 10:09:49 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-04-28 18:39:39 +02:00
|
|
|
set -o pipefail
|
2018-02-18 21:42:44 +01:00
|
|
|
|
2016-08-03 10:09:49 +02:00
|
|
|
set +e
|
2016-08-04 07:09:11 +02:00
|
|
|
|
2016-08-11 12:55:45 +02:00
|
|
|
# Script trace mode
|
2021-04-12 03:43:41 +02:00
|
|
|
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
2016-08-04 07:09:11 +02:00
|
|
|
set -o xtrace
|
|
|
|
fi
|
2016-08-03 10:09:49 +02:00
|
|
|
|
|
|
|
# Default directories
|
2016-08-11 12:55:45 +02:00
|
|
|
# Configuration files directory
|
2016-08-03 10:09:49 +02:00
|
|
|
ZABBIX_ETC_DIR="/etc/zabbix"
|
|
|
|
|
|
|
|
prepare_java_gateway_config() {
|
|
|
|
echo "** Preparing Zabbix Java Gateway log configuration file"
|
|
|
|
|
|
|
|
ZBX_GATEWAY_CONFIG=$ZABBIX_ETC_DIR/zabbix_java_gateway_logback.xml
|
|
|
|
|
|
|
|
if [ -n "${ZBX_DEBUGLEVEL}" ]; then
|
|
|
|
echo "Updating $ZBX_GATEWAY_CONFIG 'DebugLevel' parameter: '${ZBX_DEBUGLEVEL}'... updated"
|
|
|
|
if [ -f "$ZBX_GATEWAY_CONFIG" ]; then
|
|
|
|
sed -i -e "/^.*<root level=/s/=.*/=\"${ZBX_DEBUGLEVEL}\">/" "$ZBX_GATEWAY_CONFIG"
|
|
|
|
else
|
|
|
|
echo "**** Zabbix Java Gateway log configuration file '$ZBX_GATEWAY_CONFIG' not found"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
prepare_java_gateway() {
|
|
|
|
echo "** Preparing Zabbix Java Gateway"
|
|
|
|
|
|
|
|
prepare_java_gateway_config
|
|
|
|
}
|
|
|
|
|
|
|
|
#################################################
|
|
|
|
|
2020-04-28 18:39:39 +02:00
|
|
|
if [ "$1" == '/usr/sbin/zabbix_java_gateway' ]; then
|
|
|
|
prepare_java_gateway
|
2016-08-03 10:09:49 +02:00
|
|
|
fi
|
|
|
|
|
2020-04-28 18:39:39 +02:00
|
|
|
exec "$@"
|
2016-08-03 10:09:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
#################################################
|