nixos/spamassassin: Only run sa-compile when updates have been installed

This commit is contained in:
Philipp Kern 2021-01-05 14:53:14 +01:00
parent cc625c968d
commit c86b339491

View File

@ -135,13 +135,21 @@ in
User = "spamd";
Group = "spamd";
StateDirectory = "spamassassin";
ExecStart = [
"${pkgs.spamassassin}/bin/sa-update --verbose --gpghomedir=%S/spamassassin/sa-update-keys/"
"${pkgs.spamassassin}/bin/sa-compile"
];
ExecStartPost = "+${pkgs.systemd}/bin/systemctl -q --no-block try-reload-or-restart spamd.service";
SuccessExitStatus = "1";
};
script = ''
set +e
${pkgs.spamassassin}/bin/sa-update --verbose --gpghomedir=%S/spamassassin/sa-update-keys/
rc=$?
set -e
if [[ $rc -eq 0 ]]; then
# An update was available and installed.
${pkgs.spamassassin}/bin/sa-compile
fi
'';
};
systemd.timers.sa-update = {