Sync usage with man page.
[netbsd-mini2440.git] / etc / rc.d / ntpdate
blob50bf83e61664c51dde113ced311de4d8e39b9b3f
1 #!/bin/sh
3 # $NetBSD: ntpdate,v 1.19 2009/08/03 17:45:48 perry Exp $
6 # PROVIDE: ntpdate
7 # REQUIRE: NETWORKING mountcritremote syslogd named
8 # BEFORE: ntpd
10 $_rc_subr_loaded . /etc/rc.subr
12 name="ntpdate"
13 rcvar=$name
14 command="/usr/sbin/${name}"
15 start_cmd="ntpdate_start"
16 stop_cmd=":"
18 ntpdate_start()
20 if [ -z "$ntpdate_hosts" ]; then
21 ntpdate_hosts=$(awk '
22 /^#/ { next }
23 /^(server|peer)[ \t]*127.127/ { next }
24 /^(server|peer)/ { if ($2 ~ /^-[46]/)
25 print $3
26 else
27 print $2 }
28 ' </etc/ntp.conf)
30 if [ -n "$ntpdate_hosts" ]; then
31 echo "Setting date via ntp."
32 $command $rc_flags $ntpdate_hosts
36 load_rc_config $name
37 run_rc_command "$1"