diff --git a/hooks/post_domain_add b/hooks/post_domain_add new file mode 100644 index 0000000..8716a9f --- /dev/null +++ b/hooks/post_domain_add @@ -0,0 +1,12 @@ +#!/bin/bash + +# Retrieve arguments +domain=$1 +domain_label=${domain//\./_} # Replace "." by "_" for the domain label +# Add a web_log entry for this new domain +cat >> /opt/netdata/etc/netdata/python.d/web_log.conf <> /opt/netdata/etc/netdata/python.d/web_log.conf + for domain in $(yunohost domain list --output-as plain); do + domain_label=${domain//\./_} # Replace "." by "_" for the domain label + cat >> /opt/netdata/etc/netdata/python.d/web_log.conf <${tmp} pushd $NETDATA_TMPDIR ./netdata-installer.sh --install /opt --dont-wait >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA" +# If YunoHost web logs have never been set in netdata configuration, set them +if [ -z "$(grep "YUNOHOST" /opt/netdata/etc/netdata/python.d/web_log.conf)" ] ; then + netdata_add_yunohost_web_logs +fi + configure_netdata # Store the app.src file