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