]> git.proxmox.com Git - pmg-api.git/commitdiff
pmg-daily: run sa-update for local channels
authorStoiko Ivanov <s.ivanov@proxmox.com>
Tue, 19 Jan 2021 10:38:15 +0000 (11:38 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 20 Jan 2021 10:28:49 +0000 (11:28 +0100)
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/bin/pmg-daily

index 32ccb95bc896caddafb276ee36bb19ecf35a0a20..8865c94429ba3d14c9885dea2f3968ce22672769 100755 (executable)
@@ -73,12 +73,19 @@ 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);
+};
+syslog('err', "$@") if $@;
+
+PMG::Utils::service_cmd('pmg-smtp-filter', 'restart') if $restart_filter;
 # run bayes database maintainance
 system('sa-learn --force-expire >/dev/null 2>&1');