6

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?

3 Answers 3

8

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
2
  • 1
    Great answer, explains cron's basic structure in one go too :)
    – invert
    Commented Dec 4, 2009 at 8:55
  • 1
    Another possibility is to use /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
5

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.

1
  • the "-d" parameter exists at least since v0.90 which is roughly something released in 2009. (tested with clamav 0.90.1dfsg-4etch19 on an old debian)
    – hk_net
    Commented Sep 15, 2017 at 0:36
0

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:

  1. Disable the clamav-freshclam service ( as I couldn't find a way to fix the timing of this service )
systemctl stop clamav-freshclam && systemctl disable clamav-freshclam && systemctl mask clamav-freshclam
  1. Create a bash script that will be executed by cron
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

  1. Next, to fix the timing of the script, via cron, we execute the script, an example below;
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 )

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .