Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Nov 2015 00:13:10 +0100
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Dirk Engling <erdgeist@erdgeist.org>
Cc:        freebsd-rc@FreeBSD.org
Subject:   Re: etc/rc.subr rc_pid for start_cmd
Message-ID:  <20151103231310.GA70094@stack.nl>
In-Reply-To: <563933AB.5090407@erdgeist.org>
References:  <563933AB.5090407@erdgeist.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Nov 03, 2015 at 11:22:35PM +0100, Dirk Engling wrote:
> while fixing startup scripts for qmail I fell for the trap to assume
> rc.subr to do the "${name} already running? " check for me. When I then
> compared my rc script to several others from various ports/*/*/files/
> directories I could not spot any difference until I noticed they were
> also doing it wrong, and would happily spawn more daemons when their
> custom start_cmd was invoked.

> I then went over a list returned from "grep -ri start_cmd /usr/ports/"
> and found that around a third of tools (that install their rc scripts
> from the /files/ directory, i.e. they were written by FreeBSD port
> maintainers, not some unwashed Linux hippies, who do not know better) do
> not really do the check either. While the other 2/3 hilariously
> re-implemented the rc.subr check in the most creative ways.

> Has there been any historic reason this check was not done somewhere
> around /etc/rc.subr:2088 like

> if  [ $rc_arg = "start" -a -z "$rc_fast" -a -n "$rc_pid" ]; then
>   if [ -z "$rc_quiet" ]; then
>     echo 1>&2 "${name} already running? " \
>         "(pid=$rc_pid)."
>   fi
>   return 1
> fi

> maybe with a knob to turn that off for daemons that really know what
> they're doing? If not I propose to move the check before custom
> ${XXX_cmd} evaluation and will be glad to provide a diff.

The original idea was to skip the "already running" checks while booting
the system since they are quite slow, and to perform them when a manual
service FOO start is done.

-- 
Jilles Tjoelker



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