summaryrefslogtreecommitdiff
blob: dc0f3b94e9a3af6164d7a40e20eaced0587fe825 (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
#!/sbin/runscript
# Copyright 1999-2004 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.6 2005/01/27 08:39:02 ticho Exp $

depend() {
	use net
	provide antivirus
}

start() {
	if [ "${START_CLAMD}" = "yes" ]; then
		if [ -S "/tmp/clamd" ]; then
			rm -f /tmp/clamd
		fi
		if [ -n "${CLAMD_LOG}" -a ! -f "${CLAMD_LOG}" ]; then
			touch "${CLAMD_LOG}"
			chown clamav:clamav "${CLAMD_LOG}"
			CLAMD_OPTS="${CLAMD_OPTS}${CLAMD_LOG}"
		fi
		ebegin "Starting clamd"
		start-stop-daemon --start --quiet \
			--exec /usr/sbin/clamd -- ${CLAMD_OPTS}
		eend $? "Failed to start clamd"
	fi
	if [ "${START_FRESHCLAM}" = "yes" ]; then
		if [ -n "${FRESHCLAM_LOG}" ]; then
			if [ ! -f "${FRESHCLAM_LOG}" ]; then
				touch "${FRESHCLAM_LOG}"
				chown clamav:clamav "${FRESHCLAM_LOG}"
			fi
			FRESHCLAM_OPTS="${FRESHCLAM_OPTS} -l ${FRESHCLAM_LOG}"
		fi
		ebegin "Starting freshclam"
		start-stop-daemon --start --quiet \
		 --exec /usr/bin/freshclam -- ${FRESHCLAM_OPTS} 
		eend $? "Failed to start freshclam"
	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
}