From owner-freebsd-rc@FreeBSD.ORG Sun Dec 9 19:01:12 2007 Return-Path: Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B12E16A420; Sun, 9 Dec 2007 19:01:12 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (smtp6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id CAB0113C4CC; Sun, 9 Dec 2007 19:01:11 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost.infracaninophile.co.uk [IPv6:::1]) by smtp.infracaninophile.co.uk (8.14.2/8.14.1) with ESMTP id lB9J166b042170; Sun, 9 Dec 2007 19:01:06 GMT (envelope-from m.seaman@infracaninophile.co.uk) Message-ID: <475C3B71.3040105@infracaninophile.co.uk> Date: Sun, 09 Dec 2007 19:01:05 +0000 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.9 (X11/20071122) MIME-Version: 1.0 To: freebsd-rc@FreeBSD.org References: <47548755.6080707@FreeBSD.org> In-Reply-To: <47548755.6080707@FreeBSD.org> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (smtp.infracaninophile.co.uk [IPv6:::1]); Sun, 09 Dec 2007 19:01:06 +0000 (GMT) X-Virus-Scanned: ClamAV 0.91.2/5056/Sun Dec 9 10:55:13 2007 on happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on happy-idiot-talk.infracaninophile.co.uk Cc: Doug Barton Subject: Re: bin/118325: [patch] new periodic script to test statuses of daemons started via rc system X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Dec 2007 19:01:12 -0000 -----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-----