{
use esmith::config;
use esmith::db;
$OUT = '';
$min = substr(gmtime,14,2);
$copie = 'cp -u -f /usr/share/clamav/*.* /home/e-smith/files/ibays/Primary/html';
local %services;
$services{'freshclam'} = $freshclam;
my $status = db_get_prop(\%services, "freshclam", "status");
if (defined $status && $status eq "enabled")
{
my $method = db_get_prop(\%services, "freshclam", 'Method');
if ((!defined($method)) || ($method eq 'crontab'))
{
$OUT .= "\n";
$OUT .= "# freshclam times during office hours\n";
$OUT .= "\n";
my $FreshclamFreqOffice =
db_get_prop(\%services, "freshclam", 'FreqOffice');
if ($FreshclamFreqOffice)
{
if ($FreshclamFreqOffice eq 'everyhour')
{
$OUT .= $min."\t8-17\t*\t*\t1-5\troot\t/usr/bin/freshclam --quiet\n";
$OUT .= ($min+5)."\t8-17\t*\t*\t1-5\troot\t".$copie;
}
elsif ($FreshclamFreqOffice eq 'every2hrs')
{
$OUT .= $min."\t8-17/2\t*\t*\t1-5\troot\t/usr/bin/freshclam --quiet\n";
$OUT .= ($min+5)."\t8-17/2\t*\t*\t1-5\troot\t".$copie;
}
elsif ($FreshclamFreqOffice eq 'everyday')
{
$OUT .= $min."\t8\t*\t*\t1-5\troot\t/usr/bin/freshclam --quiet\n";
$OUT .= ($min+5)."\t8\t*\t*\t1-5\troot\t".$copie;
}
else
{
$OUT .= "# FreshclamFreqOffice - never\n";
}
}
else
{
$OUT .= "# FreshclamFreqOffice - not defined\n";
}
$OUT .= "\n";
$OUT .= "# freshclam times outside office hours\n";
$OUT .= "\n";
my $FreshclamFreqOutside =
db_get_prop(\%services, "freshclam", 'FreqOutside');
if ($FreshclamFreqOutside)
{
if ($FreshclamFreqOutside eq 'everyhour')
{
$OUT .= $min."\t0-7\t*\t*\t1-5\troot\t/usr/bin/freshclam --quiet\n";
$OUT .= $min."\t18-23\t*\t*\t1-5\troot\t/usr/bin/freshclam --quiet\n";
$OUT .= ($min+5)."\t0-7\t*\t*\t1-5\troot\t".$copie;
$OUT .= ($min+5)."\t18-23\t*\t*\t1-5\troot\t".$copie;
}
elsif ($FreshclamFreqOutside eq 'every2hrs')
{
$OUT .= $min."\t0-7/2\t*\t*\t1-5\troot\t/usr/bin/freshclam --quiet\n";
$OUT .= $min."\t18-23/2\t*\t*\t1-5\troot\t/usr/bin/freshclam --quiet\n";
$OUT .= ($min+5)."\t0-7/2\t*\t*\t1-5\troot\t".$copie;
$OUT .= ($min+5)."\t18-23/2\t*\t*\t1-5\troot\t".$copie;
}
elsif ($FreshclamFreqOutside eq 'everyday')
{
$OUT .= $min."\t0\t*\t*\t1-5\troot\t/usr/bin/freshclam --quiet\n";
$OUT .= ($min+5)."\t0\t*\t*\t1-5\troot\t".$copie;
}
else
{
$OUT .= "# FreshclamFreqOutside - never\n";
}
}
else
{
$OUT .= "# FreshclamFreqOutside - not defined\n";
}
$OUT .= "\n";
$OUT .= "# freshclam times during the weekend\n";
$OUT .= "\n";
my $FreshclamFreqWeekend =
db_get_prop(\%services, "freshclam", 'FreqWeekend');
if ($FreshclamFreqWeekend)
{
if ($FreshclamFreqWeekend eq 'everyhour')
{
$OUT .= $min."\t*\t*\t*\t6-7\troot\t/usr/bin/freshclam --quiet\n";
$OUT .= ($min+5)."\t*\t*\t*\t6-7\troot\t".$copie;
}
elsif ($FreshclamFreqWeekend eq 'every2hrs')
{
$OUT .= $min."\t*/2\t*\t*\t6-7\troot\t/usr/bin/freshclam --quiet\n";
$OUT .= ($min+5)."\t*/2\t*\t*\t6-7\troot\t".$copie;
}
elsif ($FreshclamFreqWeekend eq 'everyday')
{
$OUT .= $min."\t8\t*\t*\t6-7\troot\t/usr/bin/freshclam --quiet\n";
$OUT .= ($min+5)."\t8\t*\t*\t6-7\troot\t".$copie;
}
else
{
$OUT .= "# FreshclamFreqWeekend - never\n";
}
}
else
{
$OUT .= "# FreshclamFreqWeekend - not defined\n";
}
}
}
}
|