Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Feb 2017 14:17:34 +0100
From:      "Martin S. Weber" <Ephaeton@gmx.net>
To:        Alan Somers <asomers@freebsd.org>
Cc:        Cy Schubert <Cy.Schubert@komquats.com>, scrappy@freebsd.org, Brian Somers <brian@freebsd.org>, 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:  <20170215131734.GA2129@hephaistos.local>
In-Reply-To: <CAOtMX2ic=y_ZHCKRg3OF_aGWdKXbPv0UkVze3APW=7LWO9W1xg@mail.gmail.com>
References:  <asomers@freebsd.org> <CAOtMX2jr6=-fmzni537JbzRv6f9YvsrHHPgnt5HnNLjLgjd5OQ@mail.gmail.com> <201702140647.v1E6lVd8078946@slippy.cwsent.com> <20170214113643.GA3593@hephaistos.local> <CAOtMX2ic=y_ZHCKRg3OF_aGWdKXbPv0UkVze3APW=7LWO9W1xg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2017-02-14 09:29:47, Alan Somers wrote:
> Ok, the consensus opinion seems to be that:
> 1) A single sleep would be better than 3 sleeps
> 2) Periodic shouldn't sleep if no script requires it
> 3) Nothing should be backgrounded
> 4) Periodic shouldn't sleep when run interactively.
> 
> I can achieve all of this by putting a common sleep function in
> /etc/defaults/periodic.conf.  Some passing of environment variables
> will be required.  I'll put everyone on the code review when it's
> ready.

You can achieve all of this by teaching crond to introduce the random
jitter itself as well and keep the whole rc.d scripts sleep-less. This
would automatically fix periodic incantations from the command lines.
Then in the system crontab (no, not root's crontab as is wrongly documented),
just add the JITTER=3600 or equivalent to vary calls by up to an hour
(or whatever mileage you prefer) and we're all happy ;)

Regards,
-Martin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170215131734.GA2129>