1 #!/bin/sh 2 # 3 # $NetBSD: ntpdate,v 1.13 2003/10/20 16:09:15 fredb Exp $ 4 # 5 6 # PROVIDE: ntpdate 7 # REQUIRE: NETWORKING syslogd 8 9 . /etc/rc.subr 10 11 name="ntpdate" 12 rcvar=$name 13 command="/usr/sbin/${name}" 14 start_cmd="ntpdate_start" 15 stop_cmd=":" 16 17 ntpdate_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 ~ /[-]/) 24 print $3 25 else 26 print $2 } 27 /^multicastclient$/ { print "224.0.1.1" } 28 /^multicastclient/ { print $2 } 29 ' </etc/ntp.conf` 30 fi 31 if [ -n "$ntpdate_hosts" ]; then 32 echo "Setting date via ntp." 33 $command $rc_flags $ntpdate_hosts 34 fi 35 } 36 37 load_rc_config $name 38 run_rc_command "$1" 39