View | Details | Raw Unified | Return to bug 236956
Collapse All | Expand All

(-)b/etc/defaults/rc.conf (-2 / +4 lines)
Lines 363-371 Link Here
363
timed_enable="NO"		# Run the time daemon (or NO).
363
timed_enable="NO"		# Run the time daemon (or NO).
364
timed_flags=""			# Flags to timed (if enabled).
364
timed_flags=""			# Flags to timed (if enabled).
365
ntpdate_enable="NO"		# Run ntpdate to sync time on boot (or NO).
365
ntpdate_enable="NO"		# Run ntpdate to sync time on boot (or NO).
366
ntpdate_resume_enable="NO"	# Run ntpdate to sync time on resume (or NO).
366
ntpdate_program="/usr/sbin/ntpdate"	# path to ntpdate, if you want a different one.
367
ntpdate_program="/usr/sbin/ntpdate"	# path to ntpdate, if you want a different one.
367
ntpdate_flags="-b"		# Flags to ntpdate (if enabled).
368
ntpdate_flags="-b"		# Flags to ntpdate used on boot (if enabled).
368
ntpdate_config="/etc/ntp.conf"	# ntpdate(8) configuration file
369
ntpdate_resume_flags="-bu"	# Flags to ntpdate used on resume (if enabled).
370
ntpdate_config="/etc/ntp.conf"	# ntpd(8) configuration file
369
ntpdate_hosts=""		# Whitespace-separated list of ntpdate(8) servers.
371
ntpdate_hosts=""		# Whitespace-separated list of ntpdate(8) servers.
370
ntpd_enable="NO"		# Run ntpd Network Time Protocol (or NO).
372
ntpd_enable="NO"		# Run ntpd Network Time Protocol (or NO).
371
ntpd_program="/usr/sbin/ntpd"	# path to ntpd, if you want a different one.
373
ntpd_program="/usr/sbin/ntpd"	# path to ntpd, if you want a different one.
(-)b/etc/rc.d/ntpdate (-5 / +43 lines)
Lines 5-22 Link Here
5
5
6
# PROVIDE: ntpdate
6
# PROVIDE: ntpdate
7
# REQUIRE: NETWORKING syslogd
7
# REQUIRE: NETWORKING syslogd
8
# KEYWORD: nojail
8
# KEYWORD: nojail resume
9
9
10
. /etc/rc.subr
10
. /etc/rc.subr
11
11
12
name="ntpdate"
12
name="ntpdate"
13
desc="Set the date and time via NTP"
13
desc="Set the date and time via NTP"
14
rcvar="ntpdate_enable"
14
rcvar="ntpdate_enable"
15
stop_cmd=":"
15
rcvars="ntpdate_resume_enable ntpdate_program ntpdate_flags \
16
start_cmd="ntpdate_start"
16
ntpdate_resume_flags ntpdate_hosts ntpdate_config"
17
18
ntpdate_enable_defval="NO"
19
ntpdate_resume_enable_defval="NO"
20
ntpdate_program_defval="/usr/sbin/ntpdate"
21
ntpdate_flags_defval="-b"
22
ntpdate_resume_flags_defval="-bu"
23
ntpdate_hosts_defval=""
24
ntpdate_config_defval="/etc/ntp.conf"
17
25
18
ntpdate_start()
26
ntpdate_enable_desc="Run ntpdate to sync time on boot."
27
ntpdate_resume_enable_desc="Run ntpdate to sync time on resume \
28
(if enabled at boot)."
29
ntpdate_program_desc="Path to ntpdate, if you want a different one."
30
ntpdate_flags_desc="Flags to ntpdate used on boot (if enabled)."
31
ntpdate_resume_flags_desc="Flags to ntpdate used on resume (if enabled)."
32
ntpdate_hosts_desc="Whitespace-separated list of ntp(8) servers."
33
ntpdate_config_desc="ntpd(8) configuration file"
34
35
extra_commands="resume"
36
start_cmd="ntpdate_start"
37
resume_cmd="ntpdate_resume"
38
stop_cmd=":"
39
40
do_ntpdate()
19
{
41
{
42
	local options
43
	options=$1
44
20
	if [ -z "$ntpdate_hosts" -a -f "$ntpdate_config" ]; then
45
	if [ -z "$ntpdate_hosts" -a -f "$ntpdate_config" ]; then
21
		ntpdate_hosts=`awk '
46
		ntpdate_hosts=`awk '
22
			/^server[ \t]*127.127/      {next}
47
			/^server[ \t]*127.127/      {next}
Lines 27-33 Link Here
27
	fi
52
	fi
28
	if [ -n "$ntpdate_hosts" -o -n "$rc_flags" ]; then
53
	if [ -n "$ntpdate_hosts" -o -n "$rc_flags" ]; then
29
		echo "Setting date via ntp."
54
		echo "Setting date via ntp."
30
		${ntpdate_program:-ntpdate} $rc_flags $ntpdate_hosts
55
		${ntpdate_program:-ntpdate} $options $ntpdate_hosts
56
	fi
57
}
58
59
ntpdate_start()
60
{
61
	do_ntpdate $rc_flags
62
}
63
64
ntpdate_resume()
65
{
66
	# We use an unprivileged port on resume because ntpd may be running.
67
	if checkyesno ntpdate_resume_enable ; then
68
		do_ntpdate $ntpdate_resume_flags
31
	fi
69
	fi
32
}
70
}
33
71

Return to bug 236956