Commit fb528ba4 authored by Leigh Stoller's avatar Leigh Stoller

Change libreboot log file to reboot.log (instead of power.log) and add

logging to the power command (to power.log).
parent ed65140b
......@@ -65,7 +65,7 @@ my $power = "$TB/bin/power";
my $ipod = "$TB/sbin/apod";
my $vnodesetup = "$TB/sbin/vnode_setup";
my $bisend = "$TB/sbin/bootinfosend";
my $logfile = "$TB/log/power.log";
my $logfile = "$TB/log/reboot.log";
my $ping = "/sbin/ping";
my $reboot = "$TB/bin/node_reboot";
......
......@@ -23,6 +23,7 @@ my $RPCSERVER = "@OUTERBOSS_NODENAME@";
my $RPCPORT = "@OUTERBOSS_XMLRPCPORT@";
my $RPCCERT = "@OUTERBOSS_SSLCERTNAME@";
my $WOL = "$TB/sbin/whol";
my $logfile = "$TB/log/power.log";
use lib "@prefix@/lib";
use libdb;
......@@ -42,6 +43,7 @@ use StateWait;
use strict;
use English;
use Getopt::Std;
use POSIX qw(strftime);
sub usage() {
print << "END";
......@@ -71,6 +73,7 @@ my $this_user;
# Protos
sub dostatus(@);
sub dowol(@);
sub logit($);
#
# Process command-line arguments
......@@ -164,6 +167,8 @@ if ($ELABINELAB) {
exit(0)
if (! @nodelist);
logit("$op: @nodelist\n");
libxmlrpc::Config({"server" => $RPCSERVER,
"verbose" => 1,
"cert" => $RPCCERT,
......@@ -319,6 +324,8 @@ foreach my $power_id (keys %outlets) {
}
($type, $IP, $class) = $result->fetchrow();
}
# Log now, and not worry about errors. Just want to know we tried.
logit("$op: @nodes\n");
#
# Finally, we look at the controller type and construct the proper type
......@@ -595,6 +602,7 @@ sub dowol(@)
@nodeids = keys(%macs);
print "Doing a plain WOL to @nodeids via interface $iface\n";
logit("WOL: @nodeids\n");
#
# This is going to take an arbitrary length of time; we have no idea
......@@ -660,3 +668,14 @@ sub dowol(@)
}
return 0;
}
sub logit($)
{
my ($message) = @_;
my ($me) = getpwuid($UID);
# Sep 20 09:36:00 [$me] $message
open(LOG,">> $logfile");
print LOG strftime("%b %e %H:%M:%S", localtime) . " [$me] $message";
close(LOG);
}
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