Blame SOURCES/ntpdate.wrapper

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