Commit 65dcf7a7 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Fixes for newsyslog; need to flip back to root to reopen the

log file.
parent fcd6e476
...@@ -16,8 +16,9 @@ sub usage() ...@@ -16,8 +16,9 @@ sub usage()
print "Usage: checknodes_daemon [-d]\n"; print "Usage: checknodes_daemon [-d]\n";
exit(1); exit(1);
} }
my $optlist = "d"; my $optlist = "dn";
my $debug = 0; my $debug = 0;
my $impotent = 0;
# #
# Configure variables # Configure variables
...@@ -64,6 +65,9 @@ if (! getopts($optlist, \%options)) { ...@@ -64,6 +65,9 @@ if (! getopts($optlist, \%options)) {
if (defined($options{"d"})) { if (defined($options{"d"})) {
$debug++; $debug++;
} }
if (defined($options{"n"})) {
$impotent = 1;
}
# Load the Testbed support stuff. # Load the Testbed support stuff.
use lib "@prefix@/lib"; use lib "@prefix@/lib";
...@@ -152,7 +156,11 @@ if ($elabman->FlipTo($experiment->unix_gid())) { ...@@ -152,7 +156,11 @@ if ($elabman->FlipTo($experiment->unix_gid())) {
# #
sub handler() sub handler()
{ {
my $SAVEEUID = $EUID;
$EUID = 0;
ReOpenLog($LOGFILE); ReOpenLog($LOGFILE);
$EUID = $SAVEEUID;
} }
$SIG{HUP} = \&handler $SIG{HUP} = \&handler
if (!$debug); if (!$debug);
...@@ -184,6 +192,9 @@ while (1) { ...@@ -184,6 +192,9 @@ while (1) {
while (my ($nodeid,$eventstate,$stamp) = $query_result->fetchrow_array()) { while (my ($nodeid,$eventstate,$stamp) = $query_result->fetchrow_array()) {
print "Node in unknown state: $nodeid,$eventstate,$stamp\n"; print "Node in unknown state: $nodeid,$eventstate,$stamp\n";
next
if ($impotent);
my $node = Node->Lookup($nodeid); my $node = Node->Lookup($nodeid);
if (!defined($node)) { if (!defined($node)) {
print STDERR "Cannot find object for $nodeid\n"; print STDERR "Cannot find object for $nodeid\n";
...@@ -209,6 +220,11 @@ while (1) { ...@@ -209,6 +220,11 @@ while (1) {
goto loop goto loop
if (!@nodelist); if (!@nodelist);
if ($impotent) {
print "Would check @nodelist\n";
goto loop;
}
foreach my $node (@nodelist) { foreach my $node (@nodelist) {
if ($node->ClearBootAttributes()) { if ($node->ClearBootAttributes()) {
print STDERR "$node: Could not clear boot attributes.\n"; print STDERR "$node: Could not clear boot attributes.\n";
...@@ -309,7 +325,7 @@ while (1) { ...@@ -309,7 +325,7 @@ while (1) {
next; next;
} }
loop: loop:
sleep(60); sleep(($debug ? 10 : 60));
} }
exit(0); exit(0);
......
Supports Markdown
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