FW: amavis set nice level on ubuntu 18

webmaster at vbox.com.au webmaster at vbox.com.au
Tue Feb 9 04:16:51 CET 2021


Thankyou Dominic.

Yes I do want to limit amavis, as it does use a bit of memory when 
active.  No need for speed on the mail server side of things as only a 
small number of domains/mail accounts.  Using iRedMail BTW.

I have already set ClamAV to a suitable nice level using a method like 
this:
=> 
https://blog.christosoft.de/2018/07/debian-stretch-cpu-nice-level-of-daemons-like-spamassasin/

I've created a file in /etc/systemd/system/amavis.service with this 
directive.
++++
## Added to recduce the load on other service
Nice=10
++++
However, this method doesn't work for amavis on Ubuntu 18 as the 
directives are created by "systemd-sysv-generator" as note below.  I 
cannot find where that config file is so I can set the nice level in the 
file it writes desired the nice level to the generated file.

More ideas welcome, thank you.

On 2021-02-09 13:55, Postmaster @ MX wrote:
> -----Original Message-----
> From: Dominic Raferd &lt <Dominic Raferd &lt>
> Sent: Monday, 8 February 2021 10:24 PM
> To: amavis-users at amavis.org
> Subject: Re: amavis set nice level on ubuntu 18
> 
> Hello, I want to set Amavis to a nice level around 15 so other
>  services take priority.  I have done a lot of looking and found
> where the file is that can accept a nice level, say Nice=15.
> 
> However that file amavis.service is in
> /run/systemd/generator.late and is  Automatically generated
> by systemd-sysv-generator changes made to the file are
> overwritten.
> 
> I've tried putting the file amavis.service in /etc/systemd/system
> and /lib/systemd/system but systemd-sysv-generator or Amavis
> doesn't like that and throws an error.
> 
> I had found the directive DefaultLimitNICE=+15  and changed
> both=files /etc/systemd/user.conf and /etc/systemd/system.conf.
> Still no change after restart the service or even a reboot.
> 
> Can do renice but it isn't persistent.
> 
> Does anyone have any pointer on where to put the Nice=15
> directive so that it will work?
> 
> Are you sure you want to throttle Amavis rather than Clamav (which is
> called by it)? My experience is that Clamav is the resource hog, so I
> have:
> 
> # cat /etc/systemd/system/clamav-daemon.service.d/extend.conf
> [Service]
> # add -p switch to prevent error messages in syslog [D 30 Jul 2018]
> ExecStartPre=-/bin/mkdir -p /run/clamav ExecStartPre=/bin/chown clamav
> /run/clamav # prevent clamd from being a resource hog CPUQuota=80%
> Nice=10
> IOSchedulingClass=best-effort
> IOSchedulingPriority=6



More information about the amavis-users mailing list