Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 09 Dec 2007 19:01:05 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        freebsd-rc@FreeBSD.org
Cc:        Doug Barton <dougb@FreeBSD.org>
Subject:   Re: bin/118325: [patch] new periodic script to test statuses of daemons started via rc system
Message-ID:  <475C3B71.3040105@infracaninophile.co.uk>
In-Reply-To: <47548755.6080707@FreeBSD.org>
References:  <47548755.6080707@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


In his response to bin/118325 where I had submitted a periodic
script to test the status of all the services started through
the rc system

Doug Barton wrote:
> First some meta-feedback. I am disturbed to hear that some of our
> system scripts don't support the 'status' argument. I'm moderately
> disturbed that some of the ones that don't start services return
> something that could be interpreted as meaningful for it. Could you
> work up a list for both categories, and send it to
> freebsd-rc@freebsd.org? Bonus points if you include patches. :)

I've delved a bit further into this.  'status' is not one of the
standard commands provided via run_rc_command() in /etc/rc.subr.

However, if the action of the rc script is to start up a long
running process -- so that ${name}_pidfile or ${name}_procname
are set, then there is a default status action to check if a
process is running.  Thus the majority of rc scripts do in fact
provide a 'status' command, but by no means all.  Out of the
standard rc scripts in /etc/rc.d (FreeBSD 7.0-BETA3) the
following scripts do not provide 'status':

abi accounting addswap adjkerntz archdep atm1 atm2 atm3
auto_linklocal bgfsck bluetooth bridge ccd cleanvar cleartmp
devfs dmesg dumpon encswap fsck gbde geli geli2 hostid
hostname initrandom ip6fw ipfs ipfw ipnat ipsec jail kernel
kldxref ldconfig local localpkg mdconfig mdconfig2 mixer
motd mountcritlocal mountcritremote mountlate netif 
network_ipv6 nfsclient nfsserver nisdomain nsswitch ntpdate
pfsync pppoed pwcheck quota random root routing savecore
securelevel sppp swap1 syscons sysctl ugidfw virecover zfs

This contrasts with rc scripts provided for ported software:
virtually all of those start up daemon processes and hence provide
a status command automatically.

Where the action of the script is not to start up long-running
processes there are three standard rc scripts that provide an
alternate status command via extra_commands: ip6addrctl, ipfilter,
pf.  All of these print out various useful information in response
to a status command.  

In the other direction, one of the standard scripts sets 'command'
when not starting up a long running process, and so causing the
standard 'status' command to be enabled -- newsyslog.  Compare this
to accounting or ldconfig.

This patch:

% diff -u newsyslog.orig newsyslog 
- --- newsyslog.orig      2007-12-09 17:18:03.000000000 +0000
+++ newsyslog   2007-12-09 17:18:53.000000000 +0000
@@ -12,14 +12,14 @@
 name="newsyslog"
 rcvar=`set_rcvar`
 required_files="/etc/newsyslog.conf"
- -command="/usr/sbin/${name}"
+newsyslog_command="/usr/sbin/${name}"
 start_cmd="newsyslog_start"
 stop_cmd=":"
 
 newsyslog_start()
 {
        echo -n "Creating and/or trimming log files:"
- -       ${command} ${rc_flags}
+       ${newsyslog_command} ${rc_flags}
        echo "."
 }
 
changes the output from the rather misleading:

% ./newsyslog.orig status
newsyslog is not running.

to the more typical:

% ./newsyslog status 
./newsyslog: unknown directive 'status'.
Usage: ./newsyslog [fast|force|one](start|stop|restart|rcvar)

Of the other rc scripts I picked out as needing special treatment:

othermta doesn't really use the rc.subr machinery, and now that
rcorder will start up MTAs installed from ports at the correct
point anyhow, I don't really see the need for it, except as a
backwards compatibility thing.

bsdstats.sh behaves like newsyslog:

% /usr/local/etc/rc.d/bsdstats.sh status 
bsdstats is not running.

but this I will take up with the port's maintainer off-line.  There are
probably a number of other ports that inadvertently trick the rc system
into thinking it has started a daemon when it hasn't: I haven't looked.

	Matthew

- -- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHXDtx8Mjk52CukIwRCAvvAKCFUTxAGDRYyIVwOg/uArHgKj4gvgCeO5kf
thOs4fcXLhlN8sqvM2xkevs=
=3n4Y
-----END PGP SIGNATURE-----



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