一個老舊的 Perl - apache httpd Log Rotate 後台工具,
Windows/UNIX/LINUX 應該都可用。
代碼:
#!P:/Perl/bin/Perl.exe
($sec,$min,$hour,$mday,$mon,$year,$wday)=(localtime)[0,1,2,3,4,5,6];
$year += 1900;
$mon += 1;
$logg = $year."-".$mon."-".$mday.".log";
$errl = "error-".$logg;
print "Stopping APACHE2!".$/;
system( "P:\\Apache2\\bin\\apache -k stop" );
print "Renaming!...".$/;
system( "move P:\\Logs\\access.log P:\\Logs\\$logg" );
print "Renaming!...".$/;
system( "move P:\\Logs\\error.log P:\\Logs\\$errl" );
print "Restarting APACHE2!".$/;
system( "P:\\Apache2\\bin\\apache -k start" );
(2006-12-23 20:29)