Re: svn commit: r294773 - in head/etc: . defaults periodic/daily rc.d

2016-05-31 Thread Cy Schubert
In message <0100015509c22d19-fb9e2052-3ab3-4f80-b697-273cebbedcb5-00@ema
il.
amazonses.com>, Colin Percival writes:
> On 01/25/16 23:06, Cy Schubert wrote:
> > Author: cy
> > Date: Tue Jan 26 07:06:44 2016
> > New Revision: 294773
> > URL: https://svnweb.freebsd.org/changeset/base/294773
> > 
> > Log:
> >   Add support for automatic leap-second file updates.
> >   [...]
> > Added: head/etc/periodic/daily/480.leapfile-ntpd
> > ===
> ===
> > --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> > +++ head/etc/periodic/daily/480.leapfile-ntpd   Tue Jan 26 07:06:44 201
> 6 (r294773)
> > [...]
> > +   case "$daily_ntpd_avoid_congestion" in
> > +   [Yy][Ee][Ss])
> > +   # Avoid dogpiling
> > +   (sleep $(jot -r 1 0 86400); service ntpd fetch) &
> > +   ;;
> > +   *)
> > +   service ntpd fetch
> > +   ;;
> 
> Can we change this to 'service ntpd onefetch'?  If someone turns on this
> periodic script, I think it's safe to assume that they want it to run,
> even if they don't have ntpd running.  (In my case, I have some systems
> where `ntpd -q` runs from cron but I don't want to leave the daemon running
> continuously.)

Sounds good. Committed. Thanks for the suggestion.


-- 
Cheers,
Cy Schubert  or 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r294773 - in head/etc: . defaults periodic/daily rc.d

2016-05-31 Thread Colin Percival
On 01/25/16 23:06, Cy Schubert wrote:
> Author: cy
> Date: Tue Jan 26 07:06:44 2016
> New Revision: 294773
> URL: https://svnweb.freebsd.org/changeset/base/294773
> 
> Log:
>   Add support for automatic leap-second file updates.
>   [...]
> Added: head/etc/periodic/daily/480.leapfile-ntpd
> ==
> --- /dev/null 00:00:00 1970   (empty, because file is newly added)
> +++ head/etc/periodic/daily/480.leapfile-ntpd Tue Jan 26 07:06:44 2016
> (r294773)
> [...]
> + case "$daily_ntpd_avoid_congestion" in
> + [Yy][Ee][Ss])
> + # Avoid dogpiling
> + (sleep $(jot -r 1 0 86400); service ntpd fetch) &
> + ;;
> + *)
> + service ntpd fetch
> + ;;

Can we change this to 'service ntpd onefetch'?  If someone turns on this
periodic script, I think it's safe to assume that they want it to run,
even if they don't have ntpd running.  (In my case, I have some systems
where `ntpd -q` runs from cron but I don't want to leave the daemon running
continuously.)

-- 
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r294773 - in head/etc: . defaults periodic/daily rc.d

2016-01-25 Thread Cy Schubert
Author: cy
Date: Tue Jan 26 07:06:44 2016
New Revision: 294773
URL: https://svnweb.freebsd.org/changeset/base/294773

Log:
  Add support for automatic leap-second file updates.
  
  The working copy of leapfile resides in /var/dbntpd.leap-seconds.list.
  /etc/ntp/leap-seconds (periodically updated from ftp://time.nist.gov/pub/
  or ftp://tycho.usno.navy.mil/pub/ntp/) contains the master copy should
  automatic leapfile updates be disabled (default).
  
  Automatic leapfile updates are fetched from $ntp_leapfile_sources,
  defaulting to https://www.ietf.org/timezones/data/leap-seconds.list,
  within $ntp_leapfile_expiry_days (default 30 days) from leap-seconds
  file expiry. Automatic updates can be enabled by setting
  $daily_ntpd_leapfile_enable="YES" in periodic.conf. To avoid congesting
  the ntp leapfile source the automatic update randomized by default but
  can be disabled through daily_ntpd_avoid_congestion="NO" in
  periodic.conf.
  
  Suggested by: des
  Reviewed by:  des, roberto, dwmalone, ian, cperciva, glebius, gjb
  MFC after:1 week
  X-MFC with:   r289421, r293037

Added:
  head/etc/periodic/daily/480.leapfile-ntpd   (contents, props changed)
Modified:
  head/etc/defaults/periodic.conf
  head/etc/defaults/rc.conf
  head/etc/ntp.conf
  head/etc/periodic/daily/Makefile
  head/etc/rc.d/ntpd

Modified: head/etc/defaults/periodic.conf
==
--- head/etc/defaults/periodic.conf Tue Jan 26 07:06:38 2016
(r294772)
+++ head/etc/defaults/periodic.conf Tue Jan 26 07:06:44 2016
(r294773)
@@ -134,6 +134,11 @@ daily_status_mail_rejects_enable="YES" 
 daily_status_mail_rejects_logs=3   # How many logs to check
 daily_status_mail_rejects_shorten="NO" # Shorten output
 
+# 480.leapfile-ntpd
+daily_ntpd_leapfile_enable="NO"# Fetch NTP 
leapfile
+daily_ntpd_avoid_congestion="YES"  # Avoid congesting
+   # leapfile sources
+
 # 480.status-ntpd
 daily_status_ntpd_enable="NO"  # Check NTP status
 

Modified: head/etc/defaults/rc.conf
==
--- head/etc/defaults/rc.conf   Tue Jan 26 07:06:38 2016(r294772)
+++ head/etc/defaults/rc.conf   Tue Jan 26 07:06:44 2016(r294773)
@@ -362,6 +362,15 @@ ntpd_config="/etc/ntp.conf"# ntpd(8) co
 ntpd_sync_on_start="NO"# Sync time on ntpd startup, even if 
offset is high
 ntpd_flags="-p /var/run/ntpd.pid -f /var/db/ntpd.drift"
# Flags to ntpd (if enabled).
+ntp_src_leapfile="/etc/ntp/leap-seconds"
+   # Initial source for ntpd leapfile
+ntp_db_leapfile="/var/db/ntpd.leap-seconds.list"
+   # Working copy (updated weekly) leapfile
+ntp_leapfile_sources="https://www.ietf.org/timezones/data/leap-seconds.list;
+   # Source from which to fetch leapfile
+ntp_leapfile_expiry_days=30# Check for new leapfile 30 days prior to
+   # expiry.
+ntp_leapfile_fetch_verbose="NO"# Be verbose during NTP leapfile fetch
 
 # Network Information Services (NIS) options: All need rpcbind_enable="YES" ###
 nis_client_enable="NO" # We're an NIS client (or NO).

Modified: head/etc/ntp.conf
==
--- head/etc/ntp.conf   Tue Jan 26 07:06:38 2016(r294772)
+++ head/etc/ntp.conf   Tue Jan 26 07:06:44 2016(r294773)
@@ -81,4 +81,6 @@ restrict 127.127.1.0
 # See http://support.ntp.org/bin/view/Support/ConfiguringNTP#Section_6.14.
 # for documentation regarding leapfile. Updates to the file can be obtained
 # from ftp://time.nist.gov/pub/ or ftp://tycho.usno.navy.mil/pub/ntp/.
-leapfile "/etc/ntp/leap-seconds"
+# Use either leapfile in /etc/ntp or weekly updated leapfile in /var/db.
+#leapfile "/etc/ntp/leap-seconds"
+leapfile "/var/db/ntpd.leap-seconds.list"

Added: head/etc/periodic/daily/480.leapfile-ntpd
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/etc/periodic/daily/480.leapfile-ntpd   Tue Jan 26 07:06:44 2016
(r294773)
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+. /etc/defaults/periodic.conf
+source_periodic_confs
+fi
+
+case "$daily_ntpd_leapfile_enable" in
+[Yy][Ee][Ss])
+   case "$daily_ntpd_avoid_congestion" in
+   [Yy][Ee][Ss])
+   # Avoid dogpiling
+   (sleep $(jot -r 1 0 86400); service ntpd fetch) &
+   ;;
+   *)
+   service ntpd fetch
+   ;;
+   esac
+   ;;
+esac
+