2017-06-02 13:48:48 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
NAME="CLAMAV"
|
|
|
|
|
|
|
|
function stop {
|
|
|
|
echo "Stopping ${NAME}"
|
2018-01-30 11:41:32 +00:00
|
|
|
kill $(cat /var/run/clamav/clamd.pid)
|
2017-06-02 13:48:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trap 'stop' SIGTERM
|
|
|
|
|
|
|
|
if [ "$1" == "start" ]; then
|
2018-01-30 11:41:32 +00:00
|
|
|
chown -R clamav:clamav /var/lib/clamav
|
|
|
|
|
2019-05-21 12:50:53 +00:00
|
|
|
# fresclam exits when it is up to date
|
|
|
|
[ -f /var/lib/clamav/daily.cvd ] || /usr/bin/freshclam || ([ $? -eq 1 ] && /bin/true)
|
2018-01-30 11:41:32 +00:00
|
|
|
|
|
|
|
# Update Daemon
|
|
|
|
/usr/bin/freshclam -dc 6
|
|
|
|
|
2018-01-30 23:22:05 +00:00
|
|
|
[ -x /usr/sbin/clamd ] && exec /usr/sbin/clamd &
|
2017-06-02 13:48:48 +00:00
|
|
|
|
|
|
|
wait
|
|
|
|
else
|
|
|
|
exec $@
|
|
|
|
fi
|