Jean-Philippe Pialasse ce4f198792 * Sun Sep 22 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-5.sme
- workaround cron noise on squid rotate without IPv6  [SME: 12636]
2024-09-22 16:47:13 -04:00

22 lines
625 B
Plaintext

{
return "# squid is disabled\n" unless $squid{status} eq 'enabled';
my $freq = $squid{Rotate} || 'daily';
my $min = int(rand(60));
my $hour = int(rand(5));
my $dow = substr(localtime,0,3);
my $cmd = 'squid -k rotate 2>&1 |grep -v "BCP 177"';
if ($freq eq 'hourly') {
return "$min * * * * root $cmd\n";
} elsif ($freq eq 'weekly') {
return "$min $hour * * $dow root $cmd\n";
} elsif ($freq eq 'monthly') {
return "$min $hour 15 * * root $cmd\n";
} elsif ($freq eq 'disabled') {
return "# squid rotate disabled\n";
} else {
return "$min $hour * * * root $cmd\n"
}
}