Blame SOURCES/ntpdate.wrapper

473877
#!/bin/bash
473877
473877
ntpconf=/etc/ntp.conf
473877
ntpstep=/etc/ntp/step-tickers
473877
473877
[ "$EUID" != "0" ] && exit 4
473877
[ -x /usr/sbin/ntpdate ] || exit 5
473877
[ -f /etc/sysconfig/ntpdate ] || exit 6
473877
. /etc/sysconfig/ntpdate
473877
473877
[ -f $ntpstep ] && tickers=$(sed 's/#.*//' $ntpstep) || tickers=
473877
473877
if ! echo "$tickers" | grep -qi '[a-z0-9]' && [ -f $ntpconf ]; then
473877
	# the step-tickers file doesn't specify a server,
473877
	# use servers from ntp.conf instead
473877
	tickers=$(awk '$1=="peer"||$1=="server"{print $2}' $ntpconf | \
473877
		grep -Ev '127\.127\.[0-9]+\.[0-9]+')
473877
fi
473877
473877
if ! echo "$tickers" | grep -qi '[a-z0-9]'; then
473877
	echo "NTP server not specified in $ntpstep or $ntpconf"
473877
	exit 6
473877
fi
473877
473877
[ -z "$RETRIES" ] && RETRIES=2
473877
retry=0
473877
while true; do
473877
	/usr/sbin/ntpdate -U ntp -s -b $OPTIONS $tickers &> /dev/null
473877
	RETVAL=$?
473877
	[ $RETVAL -eq 0 ] || [ $retry -ge "$RETRIES" ] && break
473877
	sleep $[10 * (1 << $retry)]
473877
	retry=$[$retry + 1]
473877
done
473877
473877
[ $RETVAL -eq 0 ] && [ "$SYNC_HWCLOCK" = "yes" ] && /sbin/hwclock --systohc
473877
exit $RETVAL