Commit ef5d3922 authored by Leigh Stoller's avatar Leigh Stoller

Minor changes to logging so that newsyslog can rotate the logs.

parent 5c63cf86
......@@ -32,7 +32,11 @@ earliest time one of the steps needs to occur.
20091228: After install:
New daemon to better manage the transition of nodes into
hwdown after a failure. Start this daemon:
hwdown after a failure. In /etc/newsyslog.conf, add this line:
/usr/testbed/log/checknodes.log 640 14 300 * Z /var/run/checknodes.pid
Then start this daemon:
boss> sudo /usr/testbed/sbin/checknodes_daemon
......
......@@ -737,7 +737,6 @@ Phase "syslog", "Setting up syslog", sub {
"!capserver", "*.*\t\t\t\t\t\t$LOGDIR/capserver.log",
"!frisbeed", "*.*\t\t\t\t\t\t$LOGDIR/frisbeed.log",
"!pubsubd", "*.*\t\t\t\t\t\t$LOGDIR/pubsubd.log",
"!stated", "*.*\t\t\t\t\t\t$LOGDIR/stated.log",
"!osselect", "*.*\t\t\t\t\t\t$LOGDIR/osselect.log",
"!genlastlog","*.*\t\t\t\t\t\t$LOGDIR/genlastlog.log",
"!sdcollectd","*.*\t\t\t\t\t\t$LOGDIR/sdcollectd.log",
......@@ -780,6 +779,8 @@ Phase "syslog", "Setting up syslog", sub {
"$LOGDIR/tmcd.log 640 9 1000 * Z",
"$LOGDIR/stated.log 640 9 1000 * Z ".
"/var/run/stated.pid 31",
"$LOGDIR/checknodes.log 640 14 300 * Z ".
"/var/run/checknodes.pid",
"$LOGDIR/osselect.log 640 9 300 * Z",
"$LOGDIR/power.log 640 7 300 * Z",
"$LOGDIR/frisbeed.log 640 7 300 * Z",
......
#!/usr/bin/perl -w
#
# GENIPUBLIC-COPYRIGHT
# Copyright (c) 2009 University of Utah and the Flux Group.
# Copyright (c) 2009-2010 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
......@@ -26,6 +26,7 @@ my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $TBLOGS = "@TBLOGSEMAIL@";
my $LOGFILE = "$TB/log/checknodes.log";
my $PIDFILE = "/var/run/checknodes.pid";
my $SUDO = "/usr/local/bin/sudo";
my $PROTOUSER = "elabman";
my $WAP = "$TB/sbin/withadminprivs";
......@@ -76,6 +77,19 @@ use User;
my $NODEILL_PID = NODEILL_PID();
my $NODEILL_EID = NODEILL_EID();
#
# Check for existing pidfile and running daemon. Mostly cause
# of devel tree versions.
#
if (-e $PIDFILE) {
my $opid = `cat $PIDFILE`;
chomp($opid);
if (kill(0, $opid)) {
fatal("Lockfile $PIDFILE exists, and process $opid is running");
}
unlink($PIDFILE);
}
#
# We need this user for running below.
#
......@@ -122,6 +136,11 @@ if (! $debug) {
exit(0);
}
}
# This acts as a lockfile to prevent a devel version from running at
# the same time as the real version or another devel version.
if (system("echo '$PID' > $PIDFILE")) {
fatal("Could not create $PIDFILE!");
}
print "Check Nodes Daemon starting ... pid $$, at ".`date`;
if ($elabman->FlipTo($experiment->unix_gid())) {
......@@ -331,3 +350,4 @@ sub fatal($)
die("*** $0:\n".
" $msg\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