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