ただ/var/run/clamav/ を作りなおしてもダメらしい。
作ってもすぐ消される。
# systemctl -l status clamd
clamd.service – SYSV: Clam AntiVirus Daemon is a TCP/IP or socket protocol server.
Loaded: loaded (/etc/rc.d/init.d/clamd)
Active: failed (Result: exit-code) since 木 2014-12-18 20:06:42 JST; 20min ago
Process: 1077 ExecStart=/etc/rc.d/init.d/clamd start (code=exited, status=1/FAILURE)
systemd[1]: Starting SYSV: Clam AntiVirus Daemon is a TCP/IP or socket protocol server….
clamd[1099]: clamd daemon 0.98.4 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
clamd[1099]: Log file size limited to 4294967295 bytes.
clamd[1099]: Reading databases from /var/clamav
clamd[1099]: Not loading PUA signatures.
clamd[1099]: Bytecode: Security mode set to “TrustSigned”.
clamd[1099]: Loaded 3709847 signatures.
clamd[1099]: TCP: Bound to address 127.0.0.1 on port 3310
clamd[1099]: TCP: Setting connection queue length to 30
clamd[1099]: LOCAL: Socket file /var/run/clamav/clamd.sock could not be bound: No such file or directory
clamd[1099]: Can’t unlink the socket file /var/run/clamav/clamd.sock
clamd[1077]: Starting Clam AntiVirus Daemon: ERROR: LOCAL: Socket file /var/run/clamav/clamd.sock could not be bound: No such file or directory
clamd[1077]: ERROR: Can’t unlink the socket file /var/run/clamav/clamd.sock
clamd[1077]: [失敗]
systemd[1]: clamd.service: control process exited, code=exited status=1
systemd[1]: Failed to start SYSV: Clam AntiVirus Daemon is a TCP/IP or socket protocol server..
systemd[1]: Unit clamd.service entered failed state.
ググってみるとシャットダウン時に消しているらしいので起動時に作り直す様にした。
# vi /etc/rc.d/init.d/clamd
start(){
echo -n “Starting Clam AntiVirus Daemon: “
# ClamAV起動前にディレクトリを作成するようにした
mkdir /var/run/clamav > /dev/null 2>&1
chown clamav:clamav /var/run/clamav > /dev/null 2>&1
daemon clamd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamd
return $RETVAL
}
stop() {
echo -n “Stopping Clam AntiVirus Daemon: “
killproc clamd
rm -f /var/clamav/clamd.socket
rm -f /var/run/clamav/clamav.pid
RETVAL=$?
echo
### heres the fix… we gotta remove the stale files on restart
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamd
return $RETVAL
}