Skip to content

Commit

Permalink
Disable awstats cron job on CentOS
Browse files Browse the repository at this point in the history
  • Loading branch information
swelljoe committed Oct 1, 2017
1 parent acb4683 commit 3951120
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/Virtualmin/Config/Plugin/AWStats.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ sub actions {
$self->spin();
sleep 0.2; # XXX Pause to allow spin to start.
eval {
# Remove cronjobs for awstats on Debian/Ubuntu
foreign_require("cron");
my @jobs = &cron::list_cron_jobs();
my @dis = grep {
Expand All @@ -47,6 +48,17 @@ sub actions {
&cron::change_cron_job($job);
}
}
# Comment out cron job for awstats on CentOS/RHEL
my $file = '/etc/cron.hourly/awstats';
if (-r $file) {
my $lref = read_file_lines($file);
foreach my $l (@$lref) {
if ($l !~ /^\s*#/) {
$l = "#" . $l;
}
}
flush_file_lines($file);
}
$self->done(1); # OK!
};
if ($@) {
Expand Down

0 comments on commit 3951120

Please sign in to comment.