#!/usr/local/bin/perl -Tw # This script does log rotation. Called from crontab. use strict; $ENV{PATH}='/bin:/usr/bin'; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; ### configuration my @logfiles = qw(access_log error_log); umask 0; my $server = "httpd_perl"; my $logs_dir = "/home/httpd/$server/logs"; my $restart_command = "/home/httpd/$server/bin/apachectl restart"; my $gzip_exec = "/usr/bin/gzip -9"; # -9 is maximum compression my ($sec, $min, $hour, $mday, $mon, $year) = localtime(time); my $time = sprintf "%0.4d.%0.2d.%0.2d-%0.2d.%0.2d.%0.2d", $year+1900, ++$mon, $mday, $hour, $min, $sec; chdir $logs_dir;