#!/bin/bash ICINGAWEB2_FILE_APACHE_DEFAULT=/etc/apache2/sites-available/000-default.conf ICINGAWEB2_FILE_APACHE_PORTS=/etc/apache2/ports.conf ICINGAWEB2_PORT=8080 ## init icinga config files if need if [ -z "$(ls -A /data)" ]; then ICINGAWEB2_CONF_ONCE=false export INIT_DB=true ## move init files echo init icingaweb2 config cp -ax /data-init/* /data rm -rf /data-init ## enable modules icingacli module enable icingadb mkdir -p /etc/icingaweb2/modules/icingadb/ fi ## apache setup if [ ! -z "$ICINGAWEB2_PORT" ]; then echo set icingaweb2 apache ports sed -i "s|^Listen .*|Listen $ICINGAWEB2_PORT|" $ICINGAWEB2_FILE_APACHE_PORTS sed -i "s|VirtualHost \*:.*>|VirtualHost \*:$ICINGAWEB2_PORT>|g" $ICINGAWEB2_FILE_APACHE_DEFAULT fi ## edit icingaweb2 config only on first setup or is enabled if [ ! $ICINGAWEB2_CONF_ONCE ] || [ "$ICINGAWEB2_CONF_ONCE" = false ]; then /usr/bin/python3 /root/conf_icingaweb2.py fi ## init apache . /etc/apache2/envvars # run CMD exec "$@"