Disable clamav services

Eugene Sobolev

New Member
May 15, 2026
1
0
1
Hello.
We are using Proxmox Mail Gateway in conjunction with another antivirus solution via custom script.
Even though the clamav parameter in the admin section of /etc/pmg/pmg.conf is set to 0, and the clamav-daemon service is disabled, it starts every hour.

This happens because
Perl:
PMG::Utils::service_cmd('clamav-daemon', 'start');
is executed in /usr/lib/pmg/bin/pmg-hourly

Masking clamav-daemon.service is a bad idea - pmg-hourly.service will fail. Among other things, it is responsible for synchronization with LDAP, and in monitoring it will be unclear what exactly broke

I suggest a simple patch
Perl:
--- /usr/lib/pmg/bin/pmg-hourly.orig    2026-05-15 13:22:45.705069057 +0300
+++ /usr/lib/pmg/bin/pmg-hourly 2026-05-14 19:33:18.882627092 +0300
@@ -52,7 +52,10 @@
 system('sa-learn --sync >/dev/null 2>&1');
 
 # make sure clamav-daemon is running
-PMG::Utils::service_cmd('clamav-daemon', 'start');
+my $use_clamav = $cfg->get ('admin', 'clamav');
+if (!defined($use_clamav) || $use_clamav!=0){
+    PMG::Utils::service_cmd('clamav-daemon', 'start');
+}
 
 exit(0);

PS: Restarting the clamav-freshclam and clamav-daemon services can also occur in /usr/share/perl5/PMG/Config.pm when changing antivirus settings via the web gui.