[LON-CAPA-cvs] cvs: loncom / lchttpdlogs loncron
raeburn
raeburn at source.lon-capa.org
Thu Nov 3 18:32:04 EDT 2011
raeburn Thu Nov 3 22:32:04 2011 EDT
Added files:
/loncom lchttpdlogs
Modified files:
/loncom loncron
Log:
- Bug 6475. lchttpdlogs is script called by loncron to tail web server logs.
- Eliminate "cannot open <logfile> for reading: Permission denied errors
with /etc/init.d/loncontrol (re)start.
- tail of Apache logs now written to /home/httpd/html/lon-status/index.html
by nightly run of loncron.
Index: loncom/loncron
diff -u loncom/loncron:1.92 loncom/loncron:1.93
--- loncom/loncron:1.92 Fri Oct 28 18:38:00 2011
+++ loncom/loncron Thu Nov 3 22:32:04 2011
@@ -2,7 +2,7 @@
# Housekeeping program, started by cron, loncontrol and loncron.pl
#
-# $Id: loncron,v 1.92 2011/10/28 18:38:00 raeburn Exp $
+# $Id: loncron,v 1.93 2011/11/03 22:32:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -515,21 +515,13 @@
# ----------------------------------------------------------------------- httpd
sub check_httpd_logs {
my ($fh)=@_;
- &log($fh,'<hr /><a name="httpd" /><h2>httpd</h2><h3>Access Log</h3><pre>');
-
- open (DFH,"tail -n25 /etc/httpd/logs/access_log|");
- while (my $line=<DFH>) { &log($fh,&encode_entities($line,'<>&"')) };
- close (DFH);
-
- &log($fh,"</pre><h3>Error Log</h3><pre>");
-
- open (DFH,"tail -n25 /etc/httpd/logs/error_log|");
- while (my $line=<DFH>) {
- &log($fh,"$line");
- if ($line=~/\[error\]/) { $notices++; }
+ if (open(PIPE,"lchttpdlogs|")) {
+ while (my $line=<PIPE>) {
+ &log($fh,$line);
+ if ($line=~/\[error\]/) { $notices++; }
+ }
+ close(PIPE);
}
- close (DFH);
- &log($fh,"</pre>");
&errout($fh);
}
More information about the LON-CAPA-cvs
mailing list