2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $NetBSD: ntpdate,v 1.8 2002/03/22 04:16:39 lukem Exp $
|
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: ntpdate
|
2002-06-13 22:14:37 +00:00
|
|
|
# REQUIRE: NETWORKING syslogd
|
2004-03-08 12:25:05 +00:00
|
|
|
# KEYWORD: FreeBSD nojail
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="ntpdate"
|
2002-06-13 22:14:37 +00:00
|
|
|
rcvar=`set_rcvar`
|
2004-03-22 16:35:35 +00:00
|
|
|
stop_cmd=":"
|
|
|
|
start_cmd="ntpdate_start"
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
ntpdate_start()
|
|
|
|
{
|
2004-03-29 20:00:54 +00:00
|
|
|
if [ -z "$ntpdate_hosts" -a -f /etc/ntp.conf ]; then
|
2001-06-16 07:16:14 +00:00
|
|
|
ntpdate_hosts=`awk '
|
2002-10-12 10:31:31 +00:00
|
|
|
/^server[ \t]*127.127/ {next}
|
|
|
|
/^(server|peer)/ {print $2}
|
2001-06-16 07:16:14 +00:00
|
|
|
' </etc/ntp.conf`
|
|
|
|
fi
|
2004-03-29 20:00:54 +00:00
|
|
|
if [ -n "$ntpdate_hosts" -o -n "$rc_flags" ]; then
|
2001-06-16 07:16:14 +00:00
|
|
|
echo "Setting date via ntp."
|
2004-03-22 16:35:35 +00:00
|
|
|
${ntpdate_command:-ntpdate} $rc_flags $ntpdate_hosts
|
2001-06-16 07:16:14 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|