aboutsummaryrefslogtreecommitdiffstats
path: root/main/clamav/freshclam.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-07-24 08:01:31 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-07-24 08:01:31 +0000
commitb70981b68efcce5256eb11c6cd26ae123b10b6ea (patch)
treea38be6efae5e2ba15c2e839504632f9b7bfd5f91 /main/clamav/freshclam.initd
parent2b4df81538b8398442d5296650905c70341dd8d3 (diff)
downloadaports-b70981b68efcce5256eb11c6cd26ae123b10b6ea.tar.bz2
aports-b70981b68efcce5256eb11c6cd26ae123b10b6ea.tar.xz
moved extra/* to main/
and fixed misc build issues
Diffstat (limited to 'main/clamav/freshclam.initd')
-rw-r--r--main/clamav/freshclam.initd58
1 files changed, 58 insertions, 0 deletions
diff --git a/main/clamav/freshclam.initd b/main/clamav/freshclam.initd
new file mode 100644
index 0000000000..7961c7f807
--- /dev/null
+++ b/main/clamav/freshclam.initd
@@ -0,0 +1,58 @@
+#!/sbin/runscript
+
+opts="logfix reload"
+
+NAME=freshclam
+DAEMON=/usr/bin/$NAME
+CONF=/etc/clamav/freshclam.conf
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting freshclam"
+ start-stop-daemon --start --quiet \
+ --nicelevel ${FRESHCLAM_NICELEVEL:-0} \
+ --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
+}
+
+stop() {
+ ebegin "Stopping ${NAME}"
+ start-stop-daemon --stop --quiet --name ${NAME}
+ 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 ${DAEMON} --name $NAME
+ eend $?
+}
+
+
+logfix() {
+ # fix freshclam log permissions
+ # (might be clobbered by logrotate or something)
+ logfile=$(awk '$1 == "UpdateLogFile" { print $2 }' $CONF)
+ local freshclam_user=$(awk '$1 == "DatabaseOwner" { print $2 }' $CONF)
+ if [ -n "${logfile}" -a -n "${clamav_user}" ]; then
+ if [ ! -f "${logfile}" ]; then
+ touch ${logfile}
+ fi
+ chown ${freshclam_user} ${logfile}
+ chmod 640 ${logfile}
+ fi
+}
+