Koozali.org: home of the SME Server
Contribs.org Forums => Koozali SME Server 10.x => Topic started by: uli334 on September 24, 2022, 07:41:06 AM
-
Hello,
is there a way to set the weekly virus-scan to a scheduled time?
Thank you for answer.
Uli
-
if you know what you're doing, hack /etc/crontab through its template /etc/e-smith/templates/etc/crontab/clamav
first copy it to /etc/e-smith/templates-custom/etc/crontab/clamav , modify line 10, then set again weekly scans
-
# cat /etc/e-smith/templates/etc/crontab/clamav
{
my $min = substr(gmtime,14,2);
$OUT .= "\n";
$OUT .= "# smeserver-clamscan filesystem scan\n";
my $ScanFreq = $clamav{FilesystemScan} || 'disabled';
if ($ScanFreq eq 'daily') {
$OUT .= $min."\t0\t*\t*\t*\troot\t/sbin/e-smith/smeserver-clamscan\n";
} elsif ($ScanFreq eq 'weekly') {
$OUT .= $min."\t0\t*\t*\t6\troot\t/sbin/e-smith/smeserver-clamscan\n";
} else {
$OUT .= "# disabled\n";
}
}
the line of interest for you is
$OUT .= $min."\t0\t*\t*\t6\troot\t/sbin/e-smith/smeserver-clamscan\n";
it is currently set to run on the 6th and last day (Saturday, as 0 is Sunday, 1 is Monday...) at hour 0:$min
where $min is the minute at which the template has been expanded the last time.
-
Thank you for help,
made it like you told.
Don't i have to expand this template like " /sbin/e-smith/expand-template /etc/crontab "?
Greetings, Uli
-
yes you have to expand.
please do not modify the template, create a template custom or your mods will be deleted on next update
-
That's what i've done:
- mkdir -p /etc/e-smith/templates-custom/etc/crontab
- cp /etc/e-smith/templates/etc/crontab/clamav /etc/e-smith/templates-custom/etc/crontab
- nano /etc/e-smith/templates-custom/etc/crontab/clamav
- in the row " $OUT .= $min."\t0\t*\t*\t6\troot\t/sbin/e-smith/smeserver-clamscan\n"; " changed "t6" to "t5"
then:
- /sbin/e-smith/expand-template /etc/crontab
Right? Or some kind of failure in it?
-
Take a look!!
cat /etc/crontab
Also, check yoiu logs.
-
This is:
# smeserver-clamscan filesystem scan
49 0 * * 5 root /sbin/e-smith/smeserver-clamscan
Looks good!
Thank you very much for help!
Greetings, Uli