Commit f4c1873a authored by Leigh Stoller's avatar Leigh Stoller

Add -nologfile argument to tbend to avoid writing a log file. Used by

the web wrapper script.
parent 25a55a4d
......@@ -10,6 +10,7 @@
# through tbs_out. Returns 1 on failure and 0 on success.
my $LOGFILE;
my $logging = 0;
sub tbs_initdbi {
my($dbname) = $_[0];
......@@ -27,6 +28,7 @@ sub tbs_initlog {
print STDERR "Could not open $logfile for writing.\n";
exit(1);
};
$logging = 1;
}
sub tbs_prefix {
......@@ -39,7 +41,9 @@ sub tbs_prefix {
sub tbs_out {
my($s) = $_[0];
print $s;
print LOGFILE $s;
if ($logging) {
print LOGFILE $s;
}
};
sub tbs_exec {
......
......@@ -15,23 +15,35 @@ push(@INC,$TBSETUPLIB);
require libtbsetup;
require 'ctime.pl';
if ($#ARGV != 1) {
print STDERR "Syntax: $0 pid eid\n";
if ($#ARGV < 1 || $#ARGV > 2 ||
($#ARGV == 2 && $ARGV[0] ne "-nologfile")) {
print STDERR "Syntax: $0 [-nologfile] pid eid\n";
exit(1);
}
($pid,$eid) = @ARGV;
if ($#ARGV == 2) {
$pid = $ARGV[1];
$eid = $ARGV[2];
$dolog = 0;
}
else {
($pid,$eid) = @ARGV;
$dolog = 1;
}
use DBI;
$dbh=&tbs_initdbi($TBDB);
$prefix = "$pid-$eid";
$logfile = "$prefix-end.log";
&tbs_initlog($logfile);
if ($dolog) {
$logfile = "$prefix-end.log";
&tbs_initlog($logfile);
&tbs_out("Id: $prefix\n");
&tbs_out("Log: $logfile\n");
&tbs_out("\n");
&tbs_out("Id: $prefix\n");
&tbs_out("Log: $logfile\n");
&tbs_out("\n");
}
&tbs_out("Ending Testbed run for $prefix. " . &ctime(time) . "\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment