Koozali.org: home of the SME Server

Obsolete Releases => SME Server 8.x => Topic started by: bricknell on June 09, 2014, 11:23:08 PM

Title: ClamAV Weekly Check Time - how to change
Post by: bricknell on June 09, 2014, 11:23:08 PM
Hi,

Is there anyway to change the time of the weekly ClamAV scan?  By default it runs Friday nights at midnight - a time when my server experiences high user load.  Ideally I'd like to change it to, say, 4am.  (I've searched the wiki, forums, and google but can find nothing on how to change this default weekly scan time.)

Thanks greatly,
Tony
Title: Re: ClamAV Weekly Check Time - how to change
Post by: brianr on June 09, 2014, 11:30:54 PM
The entry is in the /etc/crontab file, however this is created using the template system, from a file:

/etc/e-smith/templates/etc/crontab/clamav

If you read here:

http://wiki.contribs.org/Template_Tutorial

You will see how it all works and how you can create a custom template to override the default.
Title: Re: ClamAV Weekly Check Time - how to change
Post by: bricknell on June 10, 2014, 12:10:07 AM
Thanks greatly for the quick reply :)

Copied clamav from /etc/e-smith/templates/etc/crontab/clamav to /etc/e-smith/templates-custom/etc/crontab/clamav and modified

    } elsif ($ScanFreq eq 'weekly') {
        $OUT .= $min."\t0\t*\t*\t6\troot\t/sbin/e-smith/smeserver-clamscan\n";

to
    } elsif ($ScanFreq eq 'weekly') {
        $OUT .= $min."\t4\t*\t*\t6\troot\t/sbin/e-smith/smeserver-clamscan\n";


Rebuilt crontab using:
expand-template /etc/crontab

And confirmed custom template accepted:
more /etc/crontab

<snip>
# smeserver-clamscan filesystem scan
00      4       *       *       6       root    /sbin/e-smith/smeserver-clamscan

<snip>

All looks well!  Lastly, restarted crond:
service crond restart

Now to wait until Friday night :D
Thanks once again,
Tony
Title: Re: ClamAV Weekly Check Time - how to change
Post by: CharlieBrady on June 10, 2014, 04:11:54 PM
Lastly, restarted crond:
service crond restart

Harmless, but not necessary. From 'man crond':

       cron  checks  each minute to see if its crontables modtime have changes and
       reload those which have changes. There is  no  need  to  restart  cron  after  some  of  the
       crontable is modified.