1#!/bin/sh 2# 3# $NetBSD: ntpdate,v 1.18 2005/03/15 12:06:12 lukem Exp $ 4# 5 6# PROVIDE: ntpdate 7# REQUIRE: NETWORKING mountcritremote syslogd 8 9$_rc_subr_loaded . /etc/rc.subr 10 11name="ntpdate" 12rcvar=$name 13command="/usr/sbin/${name}" 14start_cmd="ntpdate_start" 15stop_cmd=":" 16 17ntpdate_start() 18{ 19 if [ -z "$ntpdate_hosts" ]; then 20 ntpdate_hosts=$(awk ' 21 /^#/ { next } 22 /^(server|peer)[ \t]*127.127/ { next } 23 /^(server|peer)/ { if ($2 ~ /^-[46]/) 24 print $3 25 else 26 print $2 } 27 ' </etc/ntp.conf) 28 fi 29 if [ -n "$ntpdate_hosts" ]; then 30 echo "Setting date via ntp." 31 $command $rc_flags $ntpdate_hosts 32 fi 33} 34 35load_rc_config $name 36run_rc_command "$1" 37