From owner-freebsd-pkg@freebsd.org Tue Feb 14 16:29:48 2017 Return-Path: Delivered-To: freebsd-pkg@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF848CDF3CD for ; Tue, 14 Feb 2017 16:29:48 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 8D4D91D45 for ; Tue, 14 Feb 2017 16:29:48 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 89BB6CDF3CC; Tue, 14 Feb 2017 16:29:48 +0000 (UTC) Delivered-To: pkg@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 896C7CDF3CB for ; Tue, 14 Feb 2017 16:29:48 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-yw0-x243.google.com (mail-yw0-x243.google.com [IPv6:2607:f8b0:4002:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46B3C1D44; Tue, 14 Feb 2017 16:29:48 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-yw0-x243.google.com with SMTP id u68so9966999ywg.0; Tue, 14 Feb 2017 08:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Ro9LI5EnLjkBqS8ZyBbtN+1I2yJoQj7wUQAUKXRCtTU=; b=UI/MZNlDRYSbffJ+FDrJtTHhUHHGzpKn247tWpSx0WqPzVM7Zw8SoMYGtV9eJTeBrD lbYXVlSoDC5uyJuAdE273IK5v52V8yTQszI5Ma6O2Wb8RrxbilCKkIRYoD7Yc9qBF/q6 IIN2nKZOorB50os/ckt46HQIu7vD6gAKvDpBpQOnKSbLdVQXCr0yV5kY9/R0K5Omtci4 CIXclBqyLvGXuRhwYVqKhVI+4kT9/pM0wkFSHJVjWoYD4AG9lbLzYushVhgKbidhPbeP v0h131XuBO5p/JowJqdIjtlfXJ+AeUkdAzI8Uzb/lfsz5JPQLdphJVkO2MxYxqlv9BeS abxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Ro9LI5EnLjkBqS8ZyBbtN+1I2yJoQj7wUQAUKXRCtTU=; b=POnCz6mBlduKDLWn1AMprKafkaG27XhI8whGSReiq+RC5+9LPKR2e0QoSbpLHQs9RL mONF2wVAioZRvFyr658PM9eoKdD7XGl2H7reEYpK3dl16oV+EUbFsv61o9IwR4L5nrYM jFrMdQ7wQgO0cPywFcEtnQiitPADZNLG5LeYSXJehwZNP30gZwN6DmHdE2k3jfJwVb3X 1uQbmdETMBZ1wFqp7XS/2La7FXTQjqJkyYo+nXJoLP04ntkMOqg7AnT+W0OvWVTW+Zg+ KjjHYd+MMFObrdqO2/uWFVWbc4Tnp4+V53xm3f7br10wgK/EREvThQKksoQCVetb62mv QTrg== X-Gm-Message-State: AMke39kya4cs1OS1JSIdzgNF3yg84eLoQ9UxauUfr4G6YKhuYlZwU9ox+vHxWBWWOI21HiKU7eBRSQQIsjnSTQ== X-Received: by 10.129.164.143 with SMTP id b137mr21101643ywh.117.1487089787433; Tue, 14 Feb 2017 08:29:47 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.129.38.133 with HTTP; Tue, 14 Feb 2017 08:29:47 -0800 (PST) In-Reply-To: <20170214113643.GA3593@hephaistos.local> References: <201702140647.v1E6lVd8078946@slippy.cwsent.com> <20170214113643.GA3593@hephaistos.local> From: Alan Somers Date: Tue, 14 Feb 2017 09:29:47 -0700 X-Google-Sender-Auth: DYyCftg4IwD1H5_Bn97LsbI0REc Message-ID: Subject: Re: Bug 217055 - Consolidate random sleeps in periodic scripts To: "Martin S. Weber" Cc: Cy Schubert , scrappy@freebsd.org, Brian Somers , freebsd-bugzilla@ayaken.net, Cy Schubert , pkg@freebsd.org, =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-pkg@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Binary package management and package tools discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2017 16:29:48 -0000 On Tue, Feb 14, 2017 at 4:36 AM, Martin S. Weber wrote: > 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 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. -Alan