1135252Sseanc#!/bin/sh 2135252Sseanc# 3135252Sseanc# $FreeBSD$ 4135252Sseanc# 5135252Sseanc 6135252Sseanc# PROVIDE: ntpdate 7258121Sglebius# REQUIRE: NETWORKING syslogd 8136224Smtm# KEYWORD: nojail 9135252Sseanc 10135252Sseanc. /etc/rc.subr 11135252Sseanc 12135252Sseancname="ntpdate" 13230099Sdougbrcvar="ntpdate_enable" 14135252Sseancstop_cmd=":" 15135252Sseancstart_cmd="ntpdate_start" 16135252Sseanc 17135252Sseancntpdate_start() 18135252Sseanc{ 19251885Sdteske if [ -z "$ntpdate_hosts" -a -f "$ntpdate_config" ]; then 20135252Sseanc ntpdate_hosts=`awk ' 21135252Sseanc /^server[ \t]*127.127/ {next} 22203200Sume /^(server|peer)/ { 23203200Sume if ($2 ~/^-/) {print $3} 24203200Sume else {print $2}} 25251885Sdteske ' < "$ntpdate_config"` 26135252Sseanc fi 27135252Sseanc if [ -n "$ntpdate_hosts" -o -n "$rc_flags" ]; then 28135252Sseanc echo "Setting date via ntp." 29140391Sceri ${ntpdate_program:-ntpdate} $rc_flags $ntpdate_hosts 30135252Sseanc fi 31135252Sseanc} 32135252Sseanc 33135252Sseancload_rc_config $name 34135252Sseancrun_rc_command "$1" 35