diff options
Diffstat (limited to 'main/clamav/clamd.initd')
-rwxr-xr-x[-rw-r--r--] | main/clamav/clamd.initd | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/main/clamav/clamd.initd b/main/clamav/clamd.initd index 0e17010247..10c9c6db16 100644..100755 --- a/main/clamav/clamd.initd +++ b/main/clamav/clamd.initd @@ -20,6 +20,24 @@ start() { if [ -S "${clamd_socket:=/tmp/clamd}" ]; then rm -f ${clamd_socket} fi + + local dbdir=$(awk '$1 == "DatabaseDirectory" { print $2 }' $CONF) + local timout=${FRESHCLAM_TIMEOUT:-120} + local cvd="${dbdir:-/var/lib/clamav}"/main.cvd + + if ! [ -e "$cvd" ]; then + ebegin "Waiting for clamav database download" + while ! [ -e "$cvd" ]; do + timeout=$(( $timeout - 1 )) + if [ $timeout -eq 0 ]; then + eend 1 "Timed out" + return 1 + fi + sleep 1 + done + eend 0 + fi + ebegin "Starting ${NAME}" start-stop-daemon --start --quiet \ --nicelevel ${CLAMD_NICELEVEL:-0} \ @@ -39,7 +57,7 @@ reload() { eend 1 "${NAME} is not started" return 1 fi - start-stop-daemon --stop --oknodo --signal HUP \ + start-stop-daemon --stop --signal HUP \ --exec /usr/sbin/clamd eend $? } |