]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - etc/rc.d/ntpdate
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / etc / rc.d / ntpdate
1 #!/bin/sh
2 #
3 # $FreeBSD$
4 #
5
6 # PROVIDE: ntpdate
7 # REQUIRE: NETWORKING syslogd named
8 # KEYWORD: nojail
9
10 . /etc/rc.subr
11
12 name="ntpdate"
13 rcvar=`set_rcvar`
14 stop_cmd=":"
15 start_cmd="ntpdate_start"
16
17 ntpdate_start()
18 {
19         if [ -z "$ntpdate_hosts" -a -f ${ntpdate_config} ]; then
20                 ntpdate_hosts=`awk '
21                         /^server[ \t]*127.127/      {next}
22                         /^(server|peer)/            {print $2}
23                 ' < ${ntpdate_config}`
24         fi
25         if [ -n "$ntpdate_hosts" -o -n "$rc_flags" ]; then
26                 echo "Setting date via ntp."
27                 ${ntpdate_program:-ntpdate} $rc_flags $ntpdate_hosts
28         fi
29 }
30
31 load_rc_config $name
32 run_rc_command "$1"