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

Fix the code of waiting for ntpd to synchronize in genessis

This commit is contained in:
GONG Jie 2016-12-20 12:11:27 +08:00
parent c2d522ddf3
commit 0ec39c2a57

View File

@ -266,18 +266,18 @@ ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|
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
logger -s -t $log_label -p local4.info "Waiting for ntpd to synchronize..."
ntp-wait -n 1999 -s 1 -v
if [ $? -ne 0 ]
then
logger -s -t $log_label -p local4.info "... ntpd did not synchronize."
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"
if [ -e "/dev/rtc" ]; then
logger -s -t $log_label -p local4.info "Attempting to sync hardware clock..."
( hwclock --systohc ) </dev/null >/dev/null 2>&1 &
disown
fi
logger -s -t $log_label -p local4.info "Restarting syslog..."
read -r RSYSLOG_PID </var/run/syslogd.pid 2>/dev/null