diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-07-24 08:01:31 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-07-24 08:01:31 +0000 |
commit | b70981b68efcce5256eb11c6cd26ae123b10b6ea (patch) | |
tree | a38be6efae5e2ba15c2e839504632f9b7bfd5f91 /main/clamav/clamd.initd | |
parent | 2b4df81538b8398442d5296650905c70341dd8d3 (diff) | |
download | aports-b70981b68efcce5256eb11c6cd26ae123b10b6ea.tar.bz2 aports-b70981b68efcce5256eb11c6cd26ae123b10b6ea.tar.xz |
moved extra/* to main/
and fixed misc build issues
Diffstat (limited to 'main/clamav/clamd.initd')
-rw-r--r-- | main/clamav/clamd.initd | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/main/clamav/clamd.initd b/main/clamav/clamd.initd new file mode 100644 index 0000000000..d3b9155572 --- /dev/null +++ b/main/clamav/clamd.initd @@ -0,0 +1,56 @@ +#!/sbin/runscript + +opts="logfix reload" +NAME=clamd +CONF=/etc/clamav/clamd.conf + +depend() { + need net + provide antivirus +} + +start() { + local clamd_socket=$(awk '$1 == "LocalSocket" { print $2 }' $CONF) + + logfix + + if [ -S "${clamd_socket:=/tmp/clamd}" ]; then + rm -f ${clamd_socket} + fi + ebegin "Starting ${NAME}" + start-stop-daemon --start --quiet \ + --nicelevel ${CLAMD_NICELEVEL:-0} \ + --exec /usr/sbin/clamd + eend $? "Failed to start ${NAME}" +} + +stop() { + ebegin "Stopping ${NAME}" + start-stop-daemon --stop --quiet --exec /usr/sbin/clamd + eend $? +} + +reload() { + ebegin "Reloading ${NAME}" + if ! service_started "${NAME}" ; then + eend 1 "${NAME} is not started" + return 1 + fi + start-stop-daemon --stop --oknodo --signal HUP \ + --exec /usr/sbin/clamd + eend $? +} + +logfix() { + # fix clamd log permissions + # (might be clobbered by logrotate or something) + local logfile=`awk '$1 == "LogFile" { print $2 }' $CONF` + local clamav_user=`awk '$1 == "User" { print $2 }' $CONF` + if [ -n "${logfile}" ] && [ -n "${clamav_user}" ]; then + if [ ! -f "${logfile}" ]; then + touch ${logfile} + fi + chown ${clamav_user} ${logfile} + chmod 640 ${logfile} + fi +} |