Date: Tue, 14 Feb 2017 12:36:43 +0100 From: "Martin S. Weber" <Ephaeton@gmx.net> To: Cy Schubert <Cy.Schubert@komquats.com> Cc: Alan Somers <asomers@freebsd.org>, scrappy@freebsd.org, Brian Somers <brian@freebsd.org>, freebsd-bugzilla@ayaken.net, Cy Schubert <cy@freebsd.org>, pkg@freebsd.org, Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= <des@freebsd.org> Subject: Re: Bug 217055 - Consolidate random sleeps in periodic scripts Message-ID: <20170214113643.GA3593@hephaistos.local> In-Reply-To: <201702140647.v1E6lVd8078946@slippy.cwsent.com> References: <asomers@freebsd.org> <CAOtMX2jr6=-fmzni537JbzRv6f9YvsrHHPgnt5HnNLjLgjd5OQ@mail.gmail.com> <201702140647.v1E6lVd8078946@slippy.cwsent.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2017-02-13 22:47:31, Cy Schubert wrote: (...) > Hi Alan, > > Looking at ntp, it backgrounds itself: > > (sleep $(jot -r 1 0 3600); service ntpd onefetch) & > > To facilitate debugging, I can commit the following, if you don't mind. > > Index: periodic/daily/480.leapfile-ntpd > =================================================================== > --- periodic/daily/480.leapfile-ntpd (revision 313710) > +++ periodic/daily/480.leapfile-ntpd (working copy) > @@ -13,6 +13,7 @@ > > case "$daily_ntpd_leapfile_enable" in > [Yy][Ee][Ss]) > + tty >/dev/null 2>&1 && daily_ntpd_avoid_congestion=NO > case "$daily_ntpd_avoid_congestion" in > [Yy][Ee][Ss]) > # Avoid dogpiling You are aware that these files are invoked with < /dev/null and > file 2>&1 ? Problem with sleeping from periodic from the command line is that these extra I/O indirections make it impossible from the script file itself to determine whether or not the parent process is running from a tty or not. Cf. /usr/sbin/periodic:118 For the purpose of "my" PR, your fix is useless. An environment variable could be set that stored the fact whether or not invoker is on a TTY, and this again be checked from within the periodic scripts themselves to determine whether or not we should sleep. Btw, I hate systemd & dbus, but the discussion so far really looks like the vanilla argument "pro" SOA-style module startup :( Regards, -Martin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170214113643.GA3593>