metronome: Auto-enable/disable metronome if there's no/at least one domain configured for XMPP

This commit is contained in:
Alexandre Aubin 2023-01-31 18:17:08 +01:00
parent 456b8857ef
commit c990cee630
2 changed files with 20 additions and 2 deletions

View file

@ -74,8 +74,22 @@ do_post_regen() {
chown -R metronome: /var/lib/metronome/
chown -R metronome: /etc/metronome/conf.d/
if [[ -z "$(ls /etc/metronome/conf.d/*.cfg.lua 2>/dev/null)" ]]
then
if systemctl is-enabled metronome &>/dev/null
then
systemctl disable metronome --now 2>/dev/null
fi
else
if ! systemctl is-enabled metronome &>/dev/null
then
systemctl enable metronome --now 2>/dev/null
sleep 3
fi
[[ -z "$regen_conf_files" ]] \
|| systemctl restart metronome
fi
}
do_$1_regen ${@:2}

View file

@ -712,6 +712,10 @@ def _get_services():
"category": "web",
}
# Ignore metronome entirely if XMPP was disabled on all domains
if "metronome" in services and not glob("/etc/metronome/conf.d/*.cfg.lua"):
del services["metronome"]
# Remove legacy /var/log/daemon.log and /var/log/syslog from log entries
# because they are too general. Instead, now the journalctl log is
# returned by default which is more relevant.