[PATCH] Don't test if a service is enabled when it's required
jilles at stack.nl
Sun Aug 21 13:20:46 UTC 2011
On Sun, Aug 21, 2011 at 12:38:11AM -0700, Xin LI wrote:
> Currently we do a checkyesno before doing forcestatus on a service that
> is required. However, this way if a dependent service is enabled but
> stopped, it would not be started.
> For instance:
> echo 'mountd_enable="YES"' >> /etc/rc.conf
> /etc/rc.d/mountd stop
> /etc/rc.d/nfsd stop
> /etc/rc.d/nfsd start
> Would not start mountd.
> I'd like to propose the attached patch since it doesn't seem to be
> necessary that we test the enable status before doing forcestatus.
> Index: amd
> --- amd (revision 225055)
> +++ amd (working copy)
> @@ -23,8 +23,7 @@
> force_depend nfsclient || return 1
> - if ! checkyesno rpcbind_enable && \
> - ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
> + if ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
> force_depend rpcbind || return 1
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).
More information about the freebsd-rc