]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/rc.d/ntpdate
MFC r1.13:
[FreeBSD/FreeBSD.git] / etc / rc.d / ntpdate
1 #!/bin/sh
2 #
3 # $NetBSD: ntpdate,v 1.8 2002/03/22 04:16:39 lukem Exp $
4 # $FreeBSD$
5 #
6
7 # BEFORE: ntpd
8 # PROVIDE: ntpdate
9 # REQUIRE: NETWORKING syslogd
10 # KEYWORD: nojail
11
12 . /etc/rc.subr
13
14 name="ntpdate"
15 rcvar=`set_rcvar`
16 stop_cmd=":"
17 start_cmd="ntpdate_start"
18
19 ntpdate_start()
20 {
21         if [ -z "$ntpdate_hosts" -a -f /etc/ntp.conf ]; then
22                 ntpdate_hosts=`awk '
23                         /^server[ \t]*127.127/      {next}
24                         /^(server|peer)/            {print $2}
25                 ' </etc/ntp.conf`
26         fi
27         if [ -n "$ntpdate_hosts" -o -n "$rc_flags" ]; then
28                 echo "Setting date via ntp."
29                 ${ntpdate_program:-ntpdate} $rc_flags $ntpdate_hosts
30         fi
31 }
32
33 load_rc_config $name
34 run_rc_command "$1"