Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Dec 2005 20:14:16 +0300
From:      Yar Tikhiy <yar@comp.chem.msu.su>
To:        Ion-Mihai Tetcu <itetcu@people.tecnik93.com>
Cc:        ports@freebsd.org, freebsd-rc@freebsd.org
Subject:   Re: RC keywords question
Message-ID:  <20051205171416.GA88485@comp.chem.msu.su>
In-Reply-To: <20051205161656.GC7653@odin.ac.hmc.edu>
References:  <20051205145805.0db6cf26@it.buh.tecnik93.com> <20051205161656.GC7653@odin.ac.hmc.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Dec 05, 2005 at 08:16:56AM -0800, Brooks Davis wrote:
> On Mon, Dec 05, 2005 at 02:58:05PM +0200, Ion-Mihai Tetcu wrote:
> > 
> > I'm converting my ports to work with the new HEAD RC style and while at
> > it I also thought to check the keywords to make sure they're OK. Read
> > rcorder(8) and rc(8).
> > 
> > Let's take mail/dspam as an example. Obviously it PROVIDE: dspam
> > 
> > When run in --daemon mode dspam receives messages via LMTP and deliver
> > them via SMTP. So it REQUIRE: NETWORK; it also uses syslogd (which
> > starts BEFORE: SERVERS).
> > 
> > Now things start getting interesting.
> > 
> > Since it's a content filter, it should start before the SMTP server.
> > 
> > If SMTP server = sendmail|courier it's easy: BEFORE: mail
> > 
> > If it's postfix it's:
> > - if it's started via /etc/rc.d/sendmail (sendmail_enable="YES" and
> > postfix in /etc/mail/mailer.conf) BEFORE: mail should be enough (but see
> > below); 
> > - if sendmail_enable="NO" and /usr/local/sbin/postfix is linked in rc.d
> > as sendmail.sh then BEFORE: mail should be OK too since that's before
> > rc.d/localpkg (right ?)
> > 
> > How to interact with various ways to start qmail I have yet to discover.
> > 
> > So until here I would have:
> > PROVIDE: dspam
> > REQUIRE: NETWORK syslogd
> > BEFORE: mail
> > and since mail REQUIRE: LOGIN this is actually:
> > REQUIRE: NETWORK syslogd LOGIN
> >
> > Q: should I write all the REQUIRE keywords or just the last one (LOGIN) ?

Ideally, one should put only REQUIRE keywords for those conditions
that are *actually required* by the service, and rcorder will take
care of the rest.

> > OK, now dspam could also use mysql or pgsql; if the dependency is set
> > at compile time, it's easy to have the right REQUIRE; but dspam can
> > also use either or none, as instructed in dspam.conf so this is also
> > settable at run-time. How can I write the REQUIRE: line in this case ?
> 
> "BEFORE: mail" acts for most intents and purposes like all mail scripts
> contained "REQUIRE: dspam" so dspam does not depend on LOGIN.  As
> a rule, there's no point in depending on syslogd, just depend on
> SERVERS instead.  This is actually what DAEMON is.  I'd say that
> virtually all ports should "REQUIRE: DAEMON" unless they have more
> specific requirements. For the database support, I'd suggest setting the
> dependencies based on the ports configure options.  It's harmless to
> depend on something that doesn't actually run, but annoying to depend on
> something that doesn't exist.
> 
> The correct solution for databases is probably to add a new dummy
> script DATABASES which all the database startup scripts should declare
> they run BEFORE.  Then other startup scripts could REQUIRE that
> unconditionally even if they aren't currently configured to use a
> database and none are installed.

Just an additional remark:

In a system with complex interactions it can be hard to order rc.d
scripts properly without help from services they start.  For instance,
the database can REQURE "mail".  Then either the mail daemon should
spool mail until dspam starts after the database, or dspam should
start early and return a temporary failure condition to the mail
daemon until it can connect to the database.  Similar considerations
apply to other practical cases.

-- 
Yar



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