Ubuntu 9.10
Silly question time: When the clamav-freshclam service is running, how often is clamav checking for updates? Or do I have to manually run freshclam via a cronjob?
how often is clamav checking for updates?
Unless you setup a cronjob it will not check for updates.
Do I have to manually run freshclam via a cronjob?
The purpose of a cronjob is to automate the process. You can decide to run it in the following:
/etc/cron.daily
/etc/cron.hourly
/etc/cron.weekly
/etc/cron.monthly
I recommend cron.daily and set it up via a shell script.
sudo gedit /etc/cron.daily/freshclam.sh
add the lines:
#!/bin/sh
/usr/bin/freshclam --quiet
This will now run with all your other cron.daily jobs
Save and exit
sudo chmod 755 /etc/cron.daily/freshclam.sh
/etc/cron.d
, and it would be better because then you can run it at an arbitrary time. From clamav manual: "Please don't choose any multiple of 10, because there are already too many clients using those time slots."
Commented
Oct 14, 2015 at 6:15
actually, the "you have to run cron" is wrong.
freshclam man-pages state clearly:
-d, --daemon Run in a daemon mode. Defaults to 12 checks per day unless otherwise specified by --checks or freshclam.conf.
Google brought me here as I was looking for info on fixing the timing of the clamav-freshclam renewal service on a Ubuntu 22.04.x LTS Server. I had to fix the timing to avoid conflicts with my other servers that were also downloading extra clamav signatures from https://www.securiteinfo.com using a free account. The free account imposes a downloading limit / rate limit and i did not want to get blocked.
Steps:
systemctl stop clamav-freshclam && systemctl disable clamav-freshclam && systemctl mask clamav-freshclam
nano -c -w /some_folder/script_freshclam.sh
#!/bin/bash
## Will read from /etc/clamav/freshclam.conf
## These 3 lines are commented out
# NotifyClamd /etc/clamav/clamd.conf
# Check for new database 24 times a day
# Checks 1
/usr/bin/freshclam
0 5 * * * root /some_folder/script_freshclam.sh >/dev/null 2>&1
Note - I got additional ClamAv Signatures from https://www.securiteinfo.com/clamav-antivirus/improve-detection-rate-of-zero-day-malwares-for-clamav.shtml?lg=en
.
Upon registration for a free account, we are given links to lots of signatures that are then added into /etc/clamav/freshclam.conf
.
There are other github clamav projects but I found this way to be the easiest to use with a running/existing clamav installation in an Ubuntu box for my use case ( HomeLab / Soho )