Force ntpdate before we start the timer

To address the fact that some rax compute nodes seem to start with
a time 4hrs in the past, then jump forward abruptly, force ntpdate
update before we start accounting for time locally. Otherwise our
math might be very very wrong.

Change-Id: Ie5b7a6295f33a6639374c7ee72c682df5a0d26e9
This commit is contained in:
Sean Dague
2014-06-04 16:43:35 -04:00
committed by Jeremy Stanley
parent 3234d21e82
commit a8f4517956

View File

@@ -45,6 +45,16 @@ function tsfilter {
# create the start timer for when the job began
function start_timer {
# first make sure the time is right, so we don't go into crazy land
# later if the system decides to apply an ntp date and we jump forward
# 4 hrs (which has happened)
local default_ntp_server=$(
grep ^server /etc/ntp.conf | head -1 | awk '{print $2}')
local ntp_server=${NTP_SERVER:-$default_ntp_server}
sudo service ntp stop
sudo /usr/sbin/ntpdate $ntp_server
sudo service ntp start
sleep 1
START_TIME=`date +%s`
}
@@ -545,7 +555,7 @@ function cleanup_host {
# caught up which aren't really text, don't worry about that)
find $BASE/logs/sudoers.d $BASE/logs/etc -type f -exec mv '{}' '{}'.txt \;
# rabbitmq
# rabbitmq
if [ -f $BASE/logs/rabbitmq/ ]; then
find $BASE/logs/rabbitmq -type f -exec mv '{}' '{}'.txt \;
fi