blob: 305626ff7d97d3441a30651f3c14ee2f5b58c209 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-antivirus/clamav/files/clamd.rc,v 1.7 2005/09/29 11:54:42 ticho Exp $
depend() {
use net
provide antivirus
}
start() {
local clamd_socket=`grep ^LocalSocket /etc/clamd.conf | cut -d\ -f 2`
if [ "${START_CLAMD}" = "yes" ]; then
if [ -S "${clamd_socket:-/tmp/clamd}" ]; then
rm -f ${clamd_socket:-/tmp/clamd}
fi
ebegin "Starting clamd"
start-stop-daemon --start --quiet \
--exec /usr/sbin/clamd
eend $? "Failed to start clamd"
fi
if [ "${START_FRESHCLAM}" = "yes" ]; then
ebegin "Starting freshclam"
start-stop-daemon --start --quiet \
--exec /usr/bin/freshclam -- -d
retcode=$?
if [ ${retcode} = 1 ]; then
eend 0
einfo "Virus databases are already up to date."
else
eend ${retcode} "Failed to start freshclam"
fi
fi
if [ "${START_MILTER}" = "yes" ]; then
if [ -S "${MILTER_SOCKET}" ]; then
rm -f ${MILTER_SOCKET}
fi
local logfile=`grep -e "^LogFile" /etc/clamd.conf | cut -d\ -f 2`
local clamav_user=`grep -e "^User" /etc/clamd.conf | cut -d\ -f 2`
if [[ -n "${logfile}" && -n "${clamav_user}" ]]; then
if [ ! -f "${logfile}" ]; then
touch ${logfile}
fi
chown ${clamav_user} ${logfile}
fi
ebegin "Starting clamav-milter"
start-stop-daemon --start --quiet \
--exec /usr/sbin/clamav-milter -- ${MILTER_OPTS} ${MILTER_SOCKET}
eend $? "Failed to start clamav-milter"
fi
}
stop() {
if [ "${START_CLAMD}" = "yes" ]; then
ebegin "Stopping clamd"
start-stop-daemon --stop --quiet --name clamd
eend $? "Failed to stop clamd"
fi
if [ "${START_FRESHCLAM}" = "yes" ]; then
ebegin "Stopping freshclam"
start-stop-daemon --stop --quiet --name freshclam
eend $? "Failed to stop freshclam"
fi
if [ "${START_MILTER}" = "yes" ]; then
ebegin "Stopping clamav-milter"
start-stop-daemon --stop --quiet --name clamav-milter
eend $? "Failed to stop clamav-milter"
fi
}
|