From owner-freebsd-rc@FreeBSD.ORG Tue Aug 23 20:17:51 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26320106566B for ; Tue, 23 Aug 2011 20:17:51 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id BCA338FC17 for ; Tue, 23 Aug 2011 20:17:50 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 05B0835932F; Tue, 23 Aug 2011 22:17:49 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id E7006173E1; Tue, 23 Aug 2011 22:17:48 +0200 (CEST) Date: Tue, 23 Aug 2011 22:17:48 +0200 From: Jilles Tjoelker To: Xin LI Message-ID: <20110823201748.GA70915@stack.nl> References: <4E50B5E3.90702@delphij.net> <20110821132045.GA3940@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-rc@freebsd.org Subject: Re: [PATCH] Don't test if a service is enabled when it's required X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2011 20:17:51 -0000 On Sun, Aug 21, 2011 at 03:16:32PM -0700, Xin LI wrote: > On Sun, Aug 21, 2011 at 6:20 AM, Jilles Tjoelker wrote: > [snip] > > I don't like that this adds a bunch of unnecessary checks to the boot. > > If we are booting and the appropriate variable is set, the service is > > running and it is not necessary to check for a process (unless it > > failed, in which case there is little point in trying again). Calling > > checkyesno is much faster than checking status (which forks several > > times and reads ps output byte-by-byte with the read builtin). > That's good point but isn't the whole point of having forced > dependencies to ease use? (For instance, if nfsd requires mountd to > be started, why it starts mountd for user when _enabled="NO" and not > when _enabled="YES"? I think starting anyway makes more sense...) > I'll take a look at whether we can make the 'fast' path skip these > checks, e.g. change these checks against _enabled to check rc_fast > instead, do you think that would be more sensible solution for this? What could work is if { [ -z "$rc_fast" ] || ! checkyesno rpcbind_enable; } && ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 then force_depend rpcbind || return 1 fi This means: * If rc_fast is empty, check for a process. * If rc_fast is empty and the rc.conf variable is not set, check for a process (a check is required, since a previous script may have started the service already due to a similar check). * If rc_fast is empty and the rc.conf variable is set, do not check for a process and do not run force_depend. This looks complicated enough that it would be beneficial to move it into (a variant of) force_depend. -- Jilles Tjoelker