SOLVED clamav scan times vs. cron scan times

jeffschips

Well-Known Member
Jun 5, 2016
344
53
78
new york
cPanel Access Level
Root Administrator
Hello.
Activated clamav and see that in the control panel there is no setting on *when* to have it run when it does scan.

Alternatively there is a cron job I have (below) that does what I want (except sending me emails about the results).

So if I shut down the GUI clamav settings, i.e, untick all the directories and users to scan in the Cpanel GUI, does that prohibit the cron job as well?

I really don't need the GUI as the cronjob works just fine, however if I uninstall Clamav via the GUI will the cron job cease to work?

39 01 * * * while read domain user; do /usr/local/cpanel/3rdparty/bin/clamscan -i -r /home/"$user" 2>&1; done </etc/trueuserdomains >>/root/infections.txt
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
17,470
2,843
363
cPanel Access Level
Root Administrator
Hey there!

I installed the plugin on a test machine and the only cron I see being created is this root-level cron:

Code:
59 0 * * * /usr/local/cpanel/3rdparty/bin/freshclam --quiet --no-warnings
By default, Clamd runs as a daemon, and doesn't need a cron to function while it scans the incoming mail. However, if you want to take advantage of the additional tools it offers, such as scanning individual account directories, that would be a separate cron.

If you remove the software completely fro the WHM >> Manage Plugins page, the default cron job will also not work and be removed. If you have custom crons implemented at the user level those will just give an error that the software can't be found. When I performed my testing I didn't see any user-level crons created.

Let me know if that answers what you were looking for!
 

jeffschips

Well-Known Member
Jun 5, 2016
344
53
78
new york
cPanel Access Level
Root Administrator
Thanks. I'm okay with leaving clamav installed as a plugin and the cron you sited above updates the signatures, doesn't do any scanning. . . I think.

I've disabled all scanning in the plugin so I'm assuming the signatures will be updated and the below cron job will do the scanning.

I do want extra scanning so I've put a cron job and it seems to be running fine.

while read domain user; do /usr/local/cpanel/3rdparty/bin/clamscan -i -r /home/"$user" 2>&1; done </etc/trueuserdomains >>/root/diseases.txt
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
17,470
2,843
363
cPanel Access Level
Root Administrator
Correct - that root cron only updates the Clam software, and doesn't actually perform the scanning.

That command is perfect that will scan all the users and create that output file, so no reason you can't leave that in place. You can check out some additional configuration options in our docs here: