Koozali.org: home of the SME Server

ClamAV Weekly Check Time - how to change

Offline bricknell

  • *
  • 8
  • +0/-0
ClamAV Weekly Check Time - how to change
« 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

Offline brianr

  • *
  • 990
  • +2/-0
Re: ClamAV Weekly Check Time - how to change
« Reply #1 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.
Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........

Offline bricknell

  • *
  • 8
  • +0/-0
Re: ClamAV Weekly Check Time - how to change
« Reply #2 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

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: ClamAV Weekly Check Time - how to change
« Reply #3 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.