[pmg-devel] [PATCH pmg-api 4/4] pmg-daily: run sa-update for local channels
Stoiko Ivanov
s.ivanov at proxmox.com
Wed Dec 16 18:18:13 CET 2020
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
src/bin/pmg-daily | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/bin/pmg-daily b/src/bin/pmg-daily
index 32ccb95..f5b0650 100755
--- a/src/bin/pmg-daily
+++ b/src/bin/pmg-daily
@@ -73,12 +73,21 @@ if (my $http_proxy = $cfg->get('admin', 'http_proxy')) {
}
# update spamassassin rules
+my $restart_filter = 0;
if (system('sa-update') == 0) {
# if the exit code is 0, new updates were downloaded
# then restart the pmg-smtp-filter to load the new rules
- PMG::Utils::service_cmd('pmg-smtp-filter', 'restart');
+ $restart_filter = 1;
}
+eval {
+ $restart_filter ||= PMG::Utils::update_local_spamassassin_channels(0);
+};
+if (my $err = $@) {
+ syslog('err', $err);
+}
+
+PMG::Utils::service_cmd('pmg-smtp-filter', 'restart') if $restart_filter;
# run bayes database maintainance
system('sa-learn --force-expire >/dev/null 2>&1');
--
2.20.1
More information about the pmg-devel
mailing list