Couple of years ago I ran into this issue where amavis service kept crashing on me and that has caused issues with my e-mail server. Solution was found so why am I writing about it? What seems to be the problem? Well… IF I only edited theamavis.servicefile, reloaded the daemon and restarted the service my solution would work. Temporarily. It would work until one of the futureamavisd-newpackage upgrades overwrites my change and then amavis would crash again and my e-mail server would be dead for few hours… Don’t ask me how I know… Traumatic events… Emotional damage… 😉 Anyroad… How to make this change permanent so that I don’t have to worry about it in the future? Usesystemctl editas root.
sudo systemctl editamavisReplaceamaviswith the name of the service that You’re trying to modify.
You will be presented with something similar to this:
Make thenecessary changes in the correct place:
As You can see – there is a section at the top of the file that You need to place the changes in.
Placing changes in the wrong section of the file and saving them will result in error:
Editing “/etc/systemd/system/amavis.service.d/override.conf” canceled: temporary file is empty.
Service file contains sections. They are clearly marked with the square brackets [ and ]. My change falls into the [Service] section. As You can see I added that in my edit. IF You won’t add the correct section when creatingoverride.confyour changes will be ignored and when you’ll query the status of the service You will see something similar to this:
Jul 19 11:57:04 mail.andrzejl.eu systemd[1]: /etc/systemd/system/amavis.service.d/override.conf:1: Assignment outside of section. Ignoring.
So You have edited the file:
IF You made a mistake and You do NOT want to save the file press
+
and then press
.
To save the file press
+
and confirm with
and then
.
Now reload the daemon and restart your service
sudo systemctl daemon-reloadsudo systemctl restart amavis
You can now check the status and the modifications of the .service file. Run the following commands:
systemctl status --no-pager amavissystemctl cat amavis
As You can see the service is active, running and no changes were ignored AND the override.conf is listed below the amavis.service file.
I hope this helps!