r1130@llin: dpavlin | 2006-11-05 13:29:36 +0100
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 5 Nov 2006 12:28:37 +0000 (12:28 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 5 Nov 2006 12:28:37 +0000 (12:28 +0000)
 rotate log file on startup

git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@775 07558da8-63fa-0310-ba24-9fe276d99e06

run.pl

diff --git a/run.pl b/run.pl
index 4425fdb..11187ab 100755 (executable)
--- a/run.pl
+++ b/run.pl
@@ -135,6 +135,12 @@ die "no databases in config file!\n" unless ($config->databases);
 
 $log->info( "-" x 79 );
 
+my $log_file = 'log';
+
+if (-e $log_file ) {   # && -s $log_file > 5 * 1024 * 1024) {
+       $log->info("moved old log with ", -s $log_file, " bytes to '${log_file}.old'");
+       rename $log_file, "${log_file}.old" || $log->logwarn("can't rename $log_file to ${log_file}.old: $!");
+}
 
 my $estcmd_fh;
 my $estcmd_path = './estcmd-merge.sh';