FreeBSD Bugzilla – Attachment 203314 Details for
Bug 236956
[ntp] [patch] Optionally run ntpdate at host resume time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch allowing to optionally run ntpdate at host resume time
ntpdate-at-resume.diff (text/plain), 2.97 KB, created by
Bertrand Petit
on 2019-04-02 11:03:32 UTC
(
hide
)
Description:
Patch allowing to optionally run ntpdate at host resume time
Filename:
MIME Type:
Creator:
Bertrand Petit
Created:
2019-04-02 11:03:32 UTC
Size:
2.97 KB
patch
obsolete
>diff -r d0ec78633a34 -r 7a14ec1b314b etc/defaults/rc.conf >--- a/etc/defaults/rc.conf Wed Mar 27 15:06:58 2019 +0100 >+++ b/etc/defaults/rc.conf Tue Apr 02 12:48:57 2019 +0200 >@@ -363,9 +363,11 @@ > timed_enable="NO" # Run the time daemon (or NO). > timed_flags="" # Flags to timed (if enabled). > ntpdate_enable="NO" # Run ntpdate to sync time on boot (or NO). >+ntpdate_resume_enable="NO" # Run ntpdate to sync time on resume (or NO). > ntpdate_program="/usr/sbin/ntpdate" # path to ntpdate, if you want a different one. >-ntpdate_flags="-b" # Flags to ntpdate (if enabled). >-ntpdate_config="/etc/ntp.conf" # ntpdate(8) configuration file >+ntpdate_flags="-b" # Flags to ntpdate used on boot (if enabled). >+ntpdate_resume_flags="-bu" # Flags to ntpdate used on resume (if enabled). >+ntpdate_config="/etc/ntp.conf" # ntpd(8) configuration file > ntpdate_hosts="" # Whitespace-separated list of ntpdate(8) servers. > ntpd_enable="NO" # Run ntpd Network Time Protocol (or NO). > ntpd_program="/usr/sbin/ntpd" # path to ntpd, if you want a different one. >diff -r d0ec78633a34 -r 7a14ec1b314b etc/rc.d/ntpdate >--- a/etc/rc.d/ntpdate Wed Mar 27 15:06:58 2019 +0100 >+++ b/etc/rc.d/ntpdate Tue Apr 02 12:48:57 2019 +0200 >@@ -5,18 +5,43 @@ > > # PROVIDE: ntpdate > # REQUIRE: NETWORKING syslogd >-# KEYWORD: nojail >+# KEYWORD: nojail resume > > . /etc/rc.subr > > name="ntpdate" > desc="Set the date and time via NTP" > rcvar="ntpdate_enable" >-stop_cmd=":" >-start_cmd="ntpdate_start" >+rcvars="ntpdate_resume_enable ntpdate_program ntpdate_flags \ >+ntpdate_resume_flags ntpdate_hosts ntpdate_config" >+ >+ntpdate_enable_defval="NO" >+ntpdate_resume_enable_defval="NO" >+ntpdate_program_defval="/usr/sbin/ntpdate" >+ntpdate_flags_defval="-b" >+ntpdate_resume_flags_defval="-bu" >+ntpdate_hosts_defval="" >+ntpdate_config_defval="/etc/ntp.conf" > >-ntpdate_start() >+ntpdate_enable_desc="Run ntpdate to sync time on boot." >+ntpdate_resume_enable_desc="Run ntpdate to sync time on resume \ >+(if enabled at boot)." >+ntpdate_program_desc="Path to ntpdate, if you want a different one." >+ntpdate_flags_desc="Flags to ntpdate used on boot (if enabled)." >+ntpdate_resume_flags_desc="Flags to ntpdate used on resume (if enabled)." >+ntpdate_hosts_desc="Whitespace-separated list of ntp(8) servers." >+ntpdate_config_desc="ntpd(8) configuration file" >+ >+extra_commands="resume" >+start_cmd="ntpdate_start" >+resume_cmd="ntpdate_resume" >+stop_cmd=":" >+ >+do_ntpdate() > { >+ local options >+ options=$1 >+ > if [ -z "$ntpdate_hosts" -a -f "$ntpdate_config" ]; then > ntpdate_hosts=`awk ' > /^server[ \t]*127.127/ {next} >@@ -27,7 +52,20 @@ > fi > if [ -n "$ntpdate_hosts" -o -n "$rc_flags" ]; then > echo "Setting date via ntp." >- ${ntpdate_program:-ntpdate} $rc_flags $ntpdate_hosts >+ ${ntpdate_program:-ntpdate} $options $ntpdate_hosts >+ fi >+} >+ >+ntpdate_start() >+{ >+ do_ntpdate $rc_flags >+} >+ >+ntpdate_resume() >+{ >+ # We use an unprivileged port on resume because ntpd may be running. >+ if checkyesno ntpdate_resume_enable ; then >+ do_ntpdate $ntpdate_resume_flags > fi > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 236956
: 203314