Fix the case where $ntpdate_hosts was not specified and /etc/ntp.conf

does not exist.

Submitted by:	ru
This commit is contained in:
Dag-Erling Smørgrav 2004-03-29 20:00:54 +00:00
parent bc216e3cd2
commit 696733c7fa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127584

View File

@ -17,13 +17,13 @@ start_cmd="ntpdate_start"
ntpdate_start()
{
if [ -z "$ntpdate_hosts" ]; then
if [ -z "$ntpdate_hosts" -a -f /etc/ntp.conf ]; then
ntpdate_hosts=`awk '
/^server[ \t]*127.127/ {next}
/^(server|peer)/ {print $2}
' </etc/ntp.conf`
fi
if [ -n "$ntpdate_hosts" ]; then
if [ -n "$ntpdate_hosts" -o -n "$rc_flags" ]; then
echo "Setting date via ntp."
${ntpdate_command:-ntpdate} $rc_flags $ntpdate_hosts
fi