aboutsummaryrefslogtreecommitdiffstats
path: root/main/clamav/freshclam.initd
diff options
context:
space:
mode:
Diffstat (limited to 'main/clamav/freshclam.initd')
-rw-r--r--main/clamav/freshclam.initd30
1 files changed, 15 insertions, 15 deletions
diff --git a/main/clamav/freshclam.initd b/main/clamav/freshclam.initd
index 4b71fbf2b4..279b529066 100644
--- a/main/clamav/freshclam.initd
+++ b/main/clamav/freshclam.initd
@@ -1,17 +1,26 @@
#!/sbin/openrc-run
-extra_started_commands="reload"
-extra_commands="logfix"
+CONF=/etc/clamav/freshclam.conf
+pidfile=/run/clamav/freshclam.pid
command=/usr/bin/freshclam
-pidfile=/var/run/clamav/freshclam.pid
-CONF=/etc/clamav/freshclam.conf
+extra_started_commands="reload"
+extra_commands="logfix"
+required_files=$CONF
depend() {
need net
after firewall
}
+start_pre() {
+ local pid=`awk '$1 == "PidFile" { print $2 }' $CONF`
+ local owner=`awk '$1 == "DatabaseOwner" { print $2 }' $CONF`
+ [ "x$pid" != "x" ] && pidfile=$pid
+ checkpath --directory --owner ${owner:-clamav} \
+ --mode 750 ${pidfile%/*}
+}
+
start() {
ebegin "Starting freshclam"
start-stop-daemon --start --quiet \
@@ -23,20 +32,12 @@ start() {
eend $?
}
-stop() {
- ebegin "Stopping freshclam"
- start-stop-daemon --stop --quiet --pidfile $pidfile
- eend $?
-}
-
reload() {
- ebegin "Reloading freshclam"
- start-stop-daemon --stop --signal HUP \
- --exec $command --pidfile $pidfile
+ ebegin "Reloading ${SVCNAME}"
+ start-stop-daemon --signal HUP --pidfile $pidfile --name $SVCNAME
eend $?
}
-
logfix() {
# fix freshclam log permissions
# (might be clobbered by logrotate or something)
@@ -50,4 +51,3 @@ logfix() {
chmod 640 ${logfile}
fi
}
-