2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 17:23:08 +00:00

Merge pull request #2292 from whowutwut/genesis_logger_ntpd

Add messages to trace the ntpd commands in genesis
This commit is contained in:
Xiaopeng Wang 2016-12-08 12:25:43 +08:00 committed by GitHub
commit 0c12451375

View File

@ -262,18 +262,24 @@ openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 &
logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic"
ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}'
logger -s -t $log_label -p local4.info "Starting ntpd..."
ntpd -g -x
if [ -e "/dev/rtc" ]; then
logger -s -t $log_label -p local4.info "Attempting to sync hardware clock..."
( sleep 8 ; hwclock --systohc ) </dev/null >/dev/null 2>&1 &
disown
fi
# rv 0 state does not work with the new ntp versions
logger -s -t $log_label -p local4.info "Checking ntpq for the offset values..."
while [ "`ntpq -c 'rv 0 offset' | awk -F '=' '/offset=/ { print $2 }' | awk -F '.' '{ print $1 }' | sed s/-//`" -ge 1000 ]; do
sleep 1
done
logger -s -t $log_label -p local4.info "Checking ntpq for the offset values... Done"
logger -s -t $log_label -p local4.info "Restarting syslog..."
read -r RSYSLOG_PID </var/run/syslogd.pid 2>/dev/null
kill "$RSYSLOG_PID" 2>/dev/null
while kill -0 "$RSYSLOG_PID" 2>/dev/null