Commit c8a6811a authored by Mike Hibler's avatar Mike Hibler
Browse files

Keep track of the previous drift value and only report a new one if it

has changed.  Not a big deal when updates are 12 hours apart, but if we
shorten the interval, it will help keep gratuitous updates down.

Put a timestamp in the log when watchdog starts.
parent ab91c699
......@@ -154,6 +154,12 @@ elsif (-e "/etc/ntp/drift") {
$driftfile = "/etc/ntp/drift";
}
#
# Initial drift value, we only update if it changes
#
my $lastdrift = `cat $driftfile`;
chomp($lastdrift);
#
# Loop!
#
......@@ -171,18 +177,23 @@ while (1) {
print "Looking for new Emulab accounts ...\n";
system("update -i -l");
# Skip all this stuff in jail.
#
# Do this only for "real" nodes (cluster and remote PCs)
#
next
if (JAILED() || PLAB());
if (JAILED() || PLAB() || MFS());
#
# Send back ntpdrift info. Should move elsewhere.
#
if (!REMOTE() && !MFS() && defined($driftfile)) {
if (!REMOTE() && defined($driftfile)) {
my $drift = `cat $driftfile`;
if ($drift =~ /^([-\d\.]*)$/) {
chomp($drift);
if ($drift ne $lastdrift && $drift =~ /^([-\d\.]*)$/) {
print "Updating NTP drift from $lastdrift to $drift\n";
# Server also checks the value for sanity.
tmcc(TMCCCMD_NTPDRIFT, $1, undef, ("timeout" => 3));
$lastdrift = $drift;
}
}
if (REMOTE()) {
......@@ -206,7 +217,9 @@ sub startisalive()
}
my $failed = 0;
print "Keep alive starting up ... \n";
my $date = POSIX::strftime("20%y/%m/%d %H:%M:%S", localtime());
print "Keep alive starting up at $date\n";
while (1) {
#
......
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