Home | History | Annotate | Line # | Download | only in rc.d
ntpdate revision 1.2
      1 #!/bin/sh
      2 #
      3 # $NetBSD: ntpdate,v 1.2 2000/03/11 20:10:21 veego Exp $
      4 #
      5 
      6 # PROVIDE: ntpdate
      7 # REQUIRE: syslogd network
      8 
      9 . /etc/rc.subr
     10 . /etc/rc.conf
     11 
     12 name="ntpdate"
     13 start_precmd="checkyesno ntpdate"
     14 start_cmd="ntpdate_start"
     15 stop_cmd=":"
     16 
     17 ntpdate_start()
     18 {
     19 	if [ -z "$ntpdate_hosts" ]; then
     20 		ntpdate_hosts=`awk '
     21 		    /^server[ \t]*127.127/	{next}
     22 		    /^(server|peer)/		{print $2}
     23 		' </etc/ntp.conf`
     24 	fi
     25 	if [ -n "$ntpdate_hosts"  ]; then
     26 		echo "Setting date via ntp."
     27 		ntpdate -b -s $ntpdate_hosts
     28 	fi
     29 }
     30 
     31 run_rc_command "$1"
     32