Currently there are the two systemd service files - clamav-daemon.service - clamav-freshclam.service upstream available. Also are custom service files - clamd.service - freshclamd.service from the ebuild available.
adding the systemd team to it If someone could have a look and let me know if the upstream files are better/suitable/.. please let me know - if not then I'll try to have a look at some point soon
*** Bug 670731 has been marked as a duplicate of this bug. ***
(In reply to Thomas Raschbacher from comment #1) > adding the systemd team to it > > If someone could have a look and let me know if the upstream files are > better/suitable/.. please let me know - if not then I'll try to have a look > at some point soon See my comment in my duplicate bug #662196: (In reply to Wolfram Schlich from comment #0) > app-antivirus/clamav-0.100.2 installs 2 systemd units for clamd: > > /lib/systemd/system/clamd.service > /lib/systemd/system/clamav-daemon.service > > clamd.service seems to be the one that should be killed as it forks clamd in > the background (not systemds philosophy) and it's also not related to > clamav-daemon.socket (but clamav-daemon.service is).
would appreciate if someone who is familiar with systemd could look into this (see the comment on bug #670731)
Yes, there are duplicate service files 2731 root 20 0 10792 3608 3140 R 0.0 0.1 0:03.32 top 2681 clamav 20 0 16040 4136 3196 S 0.0 0.1 0:00.00 freshclam 2716 clamav 20 0 959828 824544 0 S 0.0 21.4 0:00.00 clamd 2722 clamav 20 0 959824 834112 9576 S 0.0 21.7 0:34.90 clamd 2726 clamav 20 0 16148 8420 7444 S 0.0 0.2 0:00.00 freshclam And their service files are -> clamav-daemon.service [Unit] Description=Clam AntiVirus userspace daemon Documentation=man:clamd(8) man:clamd.conf(5) https://www.clamav.net/documents/ Requires=clamav-daemon.socket # Check for database existence ConditionPathExistsGlob=/var/lib/clamav/main.{c[vl]d,inc} ConditionPathExistsGlob=/var/lib/clamav/daily.{c[vl]d,inc} [Service] ExecStart=/usr/sbin/clamd --foreground=true # Reload the database ExecReload=/bin/kill -USR2 $MAINPID StandardOutput=syslog [Install] WantedBy=multi-user.target Also=clamav-daemon.socket -> clamd.service [Unit] Description=clamd scanner daemon After=nss-lookup.target network.target [Service] Type=forking ExecStart=/usr/sbin/clamd Restart=on-failure PrivateTmp=true [Install] WantedBy=multi-user.target And -> clamav-freshclam.service [Unit] Description=ClamAV virus database updater Documentation=man:freshclam(1) man:freshclam.conf(5) https://www.clamav.net/documents # If user wants it run from cron, don't start the daemon. ConditionPathExists=!/etc/cron.d/clamav-freshclam [Service] ExecStart=/usr/bin/freshclam -d --foreground=true StandardOutput=syslog [Install] WantedBy=multi-user.target --> freshclamd.service [Unit] Description=clamav updater [Service] Type=forking User=clamav Group=clamav RuntimeDirectory=clamav PIDFile=/run/clamav/freshclam.pid ExecStart=/usr/bin/freshclam -d -p /run/clamav/freshclam.pid [Install] WantedBy=multi-user.target
With the change to the CMake build system some automagic for systemd was added that configures and installs systemd service files if `-DENABLE_SYSTEMD` is set _and_ the configure automagic finds a copy of systemd on the system. e.g.: https://github.com/Cisco-Talos/clamav/commit/9e20cdf6eaf545a66f55ce5ba85ef9a98dad3648#diff-ebe8ba56711ee8fb3455fbf541b2930b667ae754b598dc2a2901f9487c6d3dea I assume that the 'did I find systemd installed' gate is because of SD-notify, but as we found with OpenSSH recently we really shouldn't be linking to systemd _just_ for notify support and should instead use a shim. I'll try and submit a PR that drops the automagic at some point (I hope). Longer term, once that is in place, we need to unconditionally install the unit files provided upstream, drop our custom versions, and address any fixes there.