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