2000-03-10 14:53:23 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2003-12-04 21:28:54 +03:00
|
|
|
# $NetBSD: ntpdate,v 1.15 2003/12/04 18:28:54 drochner Exp $
|
2000-03-10 14:53:23 +03:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: ntpdate
|
2002-01-31 04:26:05 +03:00
|
|
|
# REQUIRE: NETWORKING syslogd
|
2000-03-10 14:53:23 +03:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="ntpdate"
|
2000-09-19 17:04:38 +04:00
|
|
|
rcvar=$name
|
2003-10-20 20:09:15 +04:00
|
|
|
command="/usr/sbin/${name}"
|
2000-03-10 14:53:23 +03:00
|
|
|
start_cmd="ntpdate_start"
|
|
|
|
stop_cmd=":"
|
|
|
|
|
|
|
|
ntpdate_start()
|
|
|
|
{
|
|
|
|
if [ -z "$ntpdate_hosts" ]; then
|
|
|
|
ntpdate_hosts=`awk '
|
2003-06-27 11:22:36 +04:00
|
|
|
/^#/ { next }
|
|
|
|
/^(server|peer)[ \t]*127.127/ { next }
|
2003-10-29 22:00:14 +03:00
|
|
|
/^(server|peer)/ { if ($2 ~ /^-[46]/)
|
2003-10-19 17:31:28 +04:00
|
|
|
print $3
|
|
|
|
else
|
|
|
|
print $2 }
|
2000-03-10 14:53:23 +03:00
|
|
|
' </etc/ntp.conf`
|
|
|
|
fi
|
|
|
|
if [ -n "$ntpdate_hosts" ]; then
|
|
|
|
echo "Setting date via ntp."
|
2003-10-19 17:23:57 +04:00
|
|
|
$command $rc_flags $ntpdate_hosts
|
2000-03-10 14:53:23 +03:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2000-05-13 12:45:06 +04:00
|
|
|
load_rc_config $name
|
2000-03-10 14:53:23 +03:00
|
|
|
run_rc_command "$1"
|