some issues with /usr/sbin/service

Gary Palmer gpalmer at freebsd.org
Fri Feb 15 19:32:13 UTC 2013


On Fri, Feb 15, 2013 at 02:57:10AM -0800, Jeremy Chadwick wrote:
> On Fri, Feb 15, 2013 at 11:26:11AM +0100, Alfred Bartsch wrote:
> > we want to use this script for server administration purposes. After
> > doing some testing, for now there are following issues left:
> > 
> > 1) every execution of "service -e"  casts a bunch of unnecessary
> > warnings into /var/log/messages:
> >     "... /usr/sbin/service: WARNING: $<name>_enable is not set
> > properly - see rc.conf(5)."
> >    This is caused by calling "checkyesno()", provided by /etc/subr. It
> > could be solved by using a local function, named "checkyes" or similar.
> > 
> > The following patch prohibits these annoying messages:
> > {snip}
> 
> Your patch, in effectively, "rewrites" checkyesno() to remove the warn()
> call in cases where xxx_enable variables are set to values other than
> yes/true/on/1 or no/false/off/0.
> 
> Here's a better idea:
> 
> Fix your /etc/rc.conf xxx_enable variables which contain values that
> aren't permitted.  That's what the warn() is for -- to tell you to fix
> them.  :-)

It also warns if xxx_enable isn't set.  I have a number of ports installed
which I don't want to run by default but may run later, or which have
daemons but I don't want the daemon but some other functionality.  
rsync and fetchmail are two perfect examples of the latter.

If I don't have xxx_enable in /usr/local/etc/rc.conf I get the warning.
Should I really have to go through and explicitly set the xxx_enable flags
to "no"?  Or should the code be smart enough to recognise that the variable
not being present is equivalent to "no"?

If the requirement is that all installed rc.d scripts have a xxx_enable flag
set to yes or no at all times, then the current ports infrastructure is sadly
lacking as I don't have anything under /usr/local/etc/defaults/ at all (if
that is even a valid location).  And I'd prefer ports not try and automagically
frob /etc/rc.conf, /etc/rc.conf.local or /etc/defaults/rc.conf to add/remove
xxx_enable lines as that can go wrong.

Gary


More information about the freebsd-stable mailing list