all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api 4/4] pmg-daily: run sa-update for local channels
Date: Wed, 16 Dec 2020 18:18:13 +0100	[thread overview]
Message-ID: <20201216171813.29694-5-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20201216171813.29694-1-s.ivanov@proxmox.com>

Signed-off-by: Stoiko Ivanov <s.ivanov@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





  parent reply	other threads:[~2020-12-16 17:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 17:18 [pmg-devel] [PATCH pmg-api 0/4] add support for locally configured SA channels Stoiko Ivanov
2020-12-16 17:18 ` [pmg-devel] [PATCH pmg-api 1/4] add helper for parsing SA channel.d files Stoiko Ivanov
2020-12-30 13:07   ` Fabian Grünbichler
2020-12-16 17:18 ` [pmg-devel] [PATCH pmg-api 2/4] api: spamassassin: read local channels Stoiko Ivanov
2020-12-30 13:07   ` Fabian Grünbichler
2020-12-16 17:18 ` [pmg-devel] [PATCH pmg-api 3/4] api: spamassassin: update " Stoiko Ivanov
2020-12-30 13:07   ` Fabian Grünbichler
2020-12-30 16:11     ` Stoiko Ivanov
2020-12-16 17:18 ` Stoiko Ivanov [this message]
2020-12-30 13:07   ` [pmg-devel] [PATCH pmg-api 4/4] pmg-daily: run sa-update for " Fabian Grünbichler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201216171813.29694-5-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal