[LON-CAPA-cvs] cvs: loncom / loncron

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 25 May 2004 15:20:32 -0000


albertel		Tue May 25 11:20:32 2004 EDT

  Modified files:              
    /loncom	loncron 
  Log:
  - rotate the _error files too. (Possibly BUG#3036)
  
  
Index: loncom/loncron
diff -u loncom/loncron:1.50 loncom/loncron:1.51
--- loncom/loncron:1.50	Tue May 11 17:14:23 2004
+++ loncom/loncron	Tue May 25 11:20:31 2004
@@ -2,7 +2,7 @@
 
 # Housekeeping program, started by cron, loncontrol and loncron.pl
 #
-# $Id: loncron,v 1.50 2004/05/11 21:14:23 albertel Exp $
+# $Id: loncron,v 1.51 2004/05/25 15:20:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -83,7 +83,15 @@
 	$progname='loncnew'; 
 	print "new ";
     }
-    system("$perlvar{'lonDaemons'}/$progname 2>>$perlvar{'lonDaemons'}/logs/${daemon}_errors");
+    my $error_fname="$perlvar{'lonDaemons'}/logs/${daemon}_errors";
+    my $size=(stat($error_fname))[7];
+    if ($size>40000) {
+	&log($fh,"<p>Rotating error logs ...</p>");
+	rename("$error_fname.2","$error_fname.3");
+	rename("$error_fname.1","$error_fname.2");
+	rename("$error_fname","$error_fname.1");
+    }
+    system("$perlvar{'lonDaemons'}/$progname 2>$perlvar{'lonDaemons'}/logs/${daemon}_errors");
     sleep 2;
     if (-e $pidfile) {
 	&log($fh,"<p>Seems like it started ...</p>");