#! PERL # # log.pl CGI-Script extracts the last few lines from the SCEP log and # displays them to the user # # (c) 2001 Dr. Andreas Mueller, Beratung und Entwicklung # # $Id: log.pl.in,v 1.6 2001/05/16 23:18:47 afm Exp $ # $bindir = "BINDIR"; $scepconf = $bindir."/scepconf"; # read through the openscep.cnf configuration file and extrat ldap parameters sub scepconf { local($cmd) = "${scepconf} ". join(' ', @_)." 2>/dev/null |"; open(CONF, $cmd) || die "cannot open scepconf: $!\n"; $value = ; chop $value; close(CONF); return $value; } $logfile = &scepconf("scepd", "logfile"); use CGI qw(param); if (($lines = param("lines")) <= 0) { $lines = 50; } printf("Content-Type: text/html\n\n"); printf q( OpenSCEP Log

OpenSCEP Log

); if ($logfile eq "") { printf("

log file not configured

\n"); exit(0); } printf("
\n\n");
$cmd = sprintf("/usr/bin/tail -%d %s|", $lines, $logfile);
if (open(LOG, $cmd)) { while ($_ = ) {
	print $_;
}};
printf("
\n"); printf("
\n"); printf("\n"); printf("last lines of log\n", $lines); printf("
\n"); printf q(
© 2001 The OpenSCEP Project ); exit 0;