]> git.proxmox.com Git - pmg-api.git/commitdiff
update spamassassin rules daily
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 25 Oct 2017 12:27:51 +0000 (14:27 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 27 Oct 2017 08:25:44 +0000 (10:25 +0200)
after the update, restart the pmg-smtp-filter

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
bin/pmg-daily

index 985e7d00ca71ee537c916e0e19697603f32d6cde..ebb78f2a38c590c32bc60d0c63d4d298e3275156 100755 (executable)
@@ -50,6 +50,13 @@ if (my $statlifetime = $cfg->get ('admin', 'statlifetime')) {
 # rotate razor log file
 rename('/root/.razor/razor-agent.log', '/root/.razor/razor-agent.log.0');
 
+# update spamassassin rules
+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');
+}
+
 # run bayes database maintainance
 system('sa-learn --force-expire >/dev/null 2>&1');