ntpdate revision 135252
1135252Sseanc#!/bin/sh
2135252Sseanc#
3135252Sseanc# $NetBSD: ntpdate,v 1.8 2002/03/22 04:16:39 lukem Exp $
4135252Sseanc# $FreeBSD: head/etc/rc.d/ntpdate 135252 2004-09-15 01:08:33Z seanc $
5135252Sseanc#
6135252Sseanc
7135252Sseanc# BEFORE: ntpd
8135252Sseanc# PROVIDE: ntpdate
9135252Sseanc# REQUIRE: NETWORKING syslogd
10135252Sseanc# KEYWORD: FreeBSD nojail
11135252Sseanc
12135252Sseanc. /etc/rc.subr
13135252Sseanc
14135252Sseancname="ntpdate"
15135252Sseancrcvar=`set_rcvar`
16135252Sseancstop_cmd=":"
17135252Sseancstart_cmd="ntpdate_start"
18135252Sseanc
19135252Sseancntpdate_start()
20135252Sseanc{
21135252Sseanc	if [ -z "$ntpdate_hosts" -a -f /etc/ntp.conf ]; then
22135252Sseanc		ntpdate_hosts=`awk '
23135252Sseanc			/^server[ \t]*127.127/      {next}
24135252Sseanc			/^(server|peer)/            {print $2}
25135252Sseanc		' </etc/ntp.conf`
26135252Sseanc	fi
27135252Sseanc	if [ -n "$ntpdate_hosts" -o -n "$rc_flags" ]; then
28135252Sseanc		echo "Setting date via ntp."
29135252Sseanc		${ntpdate_command:-ntpdate} $rc_flags $ntpdate_hosts
30135252Sseanc	fi
31135252Sseanc}
32135252Sseanc
33135252Sseancload_rc_config $name
34135252Sseancrun_rc_command "$1"
35