1

我已安装并ClamAV在作为 systemd 服务CentOS 7.3启动时遇到问题。clamd

当我从命令行 ( /usr/sbin/clamd -c /etc/clamd.conf) 手动启动 clamd 时,一切顺利,我可以使用 clamdscan 进行连接。

当我通过 systemd ( systemctl start clamd) 启动 clamd 时,clamd 启动并在几秒钟后终止,并在日志文件中显示消息“等待所有线程完成”。

有谁知道为什么 clamd 可以从命令行启动但不能作为服务启动?配置和日志文件如下。谢谢你。

/usr/lib/systemd/system/clamd.service:

[Unit]
Description = clamd scanner daemon
After = network.target

[Service]
ExecStart = /usr/sbin/clamd -c /etc/clamd.conf
PrivateTmp = true

[Install]
WantedBy=multi-user.target

/etc/clamd.conf:

LogFile /tmp/clamd.log
LogTime true
LogVerbose true
TCPSocket 3310
TCPAddr localhost

日志文件:

Thu Aug 31 09:52:18 2017 -> +++ Started at Thu Aug 31 09:52:18 2017
Thu Aug 31 09:52:18 2017 -> Received 0 file descriptor(s) from systemd
Thu Aug 31 09:52:18 2017 -> clamd daemon 0.99.2 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
Thu Aug 31 09:52:18 2017 -> Log file size limited to 1048576 bytes.
Thu Aug 31 09:52:18 2017 -> Reading databases from /var/lib/clamav
Thu Aug 31 09:52:18 2017 -> Not loading PUA signatures.
Thu Aug 31 09:52:18 2017 -> Bytecode: Security mode set to "TrustSigned".
Thu Aug 31 09:52:24 2017 -> Loaded 6303399 signatures.
Thu Aug 31 09:52:26 2017 -> TCP: Bound to [127.0.0.1]:3310
Thu Aug 31 09:52:26 2017 -> TCP: Stting connection queue length to 200
Thu Aug 31 09:52:26 2017 -> Limits: Global size limit set to 104857600 bytes.
Thu Aug 31 09:52:26 2017 -> Limits: File size limit set to 26214400 bytes.
Thu Aug 31 09:52:26 2017 -> Limits: Recursion level limit set to 16.
Thu Aug 31 09:52:26 2017 -> Limits: Files limit set to 10000.
Thu Aug 31 09:52:26 2017 -> Limits: Core-dump limit is 0.
Thu Aug 31 09:52:26 2017 -> Limits: MaxEmbeddedPE limit set to 10485760 bytes.
Thu Aug 31 09:52:26 2017 -> Limits: MaxHTMLNormalize limit set to 10485760 bytes.
Thu Aug 31 09:52:26 2017 -> Limits: MaxHTMLNoTags limit set to 2097152 bytes.
Thu Aug 31 09:52:26 2017 -> Limits: MaxScriptNormalize limit set to 5242880 bytes.
Thu Aug 31 09:52:26 2017 -> Limits: MaxZipTypeRcg limit set to 1048576 bytes.
Thu Aug 31 09:52:26 2017 -> Limits: MaxPartitions limit set to 50.
Thu Aug 31 09:52:26 2017 -> Limits: MaxIconsPE limit set to 100.
Thu Aug 31 09:52:26 2017 -> Limits: MaxRecHWP3 limit set to 16.
Thu Aug 31 09:52:26 2017 -> Limits: PCREMatchLimit limit set to 10000.
Thu Aug 31 09:52:26 2017 -> Limits: PCRERecMatchLimit set to 5000.
Thu Aug 31 09:52:26 2017 -> Limits: PCREMaxFileSize limit set to 26214400.
Thu Aug 31 09:52:26 2017 -> Archive support enabled.
Thu Aug 31 09:52:26 2017 -> Algorithmic detection enabled.
Thu Aug 31 09:52:26 2017 -> Portable Executable support enabled.
Thu Aug 31 09:52:26 2017 -> ELF support enabled.
Thu Aug 31 09:52:26 2017 -> Mail files support enabled.
Thu Aug 31 09:52:26 2017 -> OLE2 support enabled.
Thu Aug 31 09:52:26 2017 -> PDF support enabled.
Thu Aug 31 09:52:26 2017 -> SWF support enabled.
Thu Aug 31 09:52:26 2017 -> HTML support enabled.
Thu Aug 31 09:52:26 2017 -> XMLDOCS support enabled.
Thu Aug 31 09:52:26 2017 -> HWP3 support enabled.
Thu Aug 31 09:52:26 2017 -> Self checking every 600 seconds.
Thu Aug 31 09:52:26 2017 -> Listening daemon: PID: 5518
Thu Aug 31 09:52:26 2017 -> MaxQueue set to: 100
Thu Aug 31 09:52:28 2017 -> Waiting for all threads to finish.
Thu Aug 31 09:52:29 2017 -> Shutting down the main socket.
Thu Aug 31 09:52:29 2017 -> --- Stopped at Thu Aug 31 09:52:29 2017
Thu Aug 31 09:52:29 2017 -> Closing the main socket

systemctl 状态命令

clamd.service - clamd scanner daemon
Loaded: loaded (/usr/lib/systemd/system/clamd.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Thu 2017-08-31 09:52:29 UTC; 42 min ago
Main PID: 5516 (code=exited, status=0/SUCCESS)

Aug 31 09:52:18 localhost.localdomain systemd[1]: Started clamd scanner daemon.
Aug 31 09:52:18 localhost.localdomain systemd[1]: Starting clamd scanner daemon ...
4

1 回答 1

0

我在安装时搞砸了,错过了安装 clamav-server-systemd 软件包等。

现在工作正常。

于 2017-09-01T13:14:42.180 回答