How to run clamd by systemd as daemon on Centos 7

# rpm -q centos-release

# rpm -qa clam

Below [email protected] as is.

# cat /usr/lib/systemd/system/[email protected]
Description = clamd scanner (%i) daemon
After =

Type = forking
ExecStart = /usr/sbin/clamd -c /etc/clamd.d/%i.conf
Restart = on-failure

I use the standard config with defaults settings

# /etc/clamd.d/mail.conf
LogSyslog yes
TCPSocket 3310
User clamscan


After start no any errors

# systemctl start [email protected]

09:02:35 -- clamd[3644]: Limits: Global size limit set to 104857600 bytes.
09:03:39 -- clamd[3664]: Received 0 file descriptor(s) from systemd.
09:03:39 -- clamd[3664]: clamd daemon 0.100.0 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
09:03:39 -- clamd[3664]: Running as user clamscan (UID 992, GID 989)
09:03:39 -- clamd[3664]: Log file size limited to 1048576 bytes.
09:03:39 -- clamd[3664]: Reading databases from /var/lib/clamav
09:03:39 -- clamd[3664]: Not loading PUA signatures.
09:03:39 -- clamd[3664]: Bytecode: Security mode set to "TrustSigned".
09:04:01 -- clamd[3664]: Loaded 6575820 signatures.
09:04:08 -- clamd[3664]: TCP: Bound to []:3310
09:04:08 -- clamd[3664]: TCP: Setting connection queue length to 200


# systemctl status [email protected][email protected] - clamd scanner (rspamd) daemon
Loaded: loaded (/usr/lib/systemd/system/[email protected]; static; vendor preset: disabled)
Active: inactive (dead)

# lsof -i | grep 3310

Looks like the service was not run as daemon. I tried to edit the /usr/lib/systemd/system/[email protected], but got no expected result (it always restart)

Type = simple
ExecStart = /usr/sbin/clamd -c /etc/clamd.d/%i.conf --foreground=yes
Restart = on-failure

Server Fault Asked by vczm on November 18, 2021

1 Answers

One Answer

The problem was in RAM. Used 512Mb, after increase it to 896Mb the problem was solved.

No need to use --foreground=all to run the service. This parameter also can be use in /etc/clamd.d/mail.conf

Answered by vczm on November 18, 2021

Add your own answers!

Related Questions

Nginx: implementing country block with a map

0  Asked on January 15, 2021 by sandro-b


Server wide auth for all Virtualhosts

0  Asked on January 15, 2021


Action log of last ssh login

2  Asked on January 15, 2021 by andrewl64


Ansible loops and conditions with arrays

1  Asked on January 14, 2021 by eviltorbalan


DB2 Integrity Checks and Exception Tables

1  Asked on January 14, 2021 by imthefirestartr


MySql Can’t Start on Ubuntu 20.04 LTS

0  Asked on January 13, 2021 by john-gab-tolentino


Opera Mini Compression Technology

0  Asked on January 13, 2021 by myzel394


What does systemd “thawing” mean?

0  Asked on January 12, 2021 by johannes-ernst


Ask a Question

Get help from others!

© 2021 All rights reserved.