From owner-freebsd-stable@FreeBSD.ORG Fri Feb 15 10:57:13 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id ED4E3396 for ; Fri, 15 Feb 2013 10:57:13 +0000 (UTC) (envelope-from jdc@koitsu.org) Received: from qmta07.emeryville.ca.mail.comcast.net (qmta07.emeryville.ca.mail.comcast.net [IPv6:2001:558:fe2d:43:76:96:30:64]) by mx1.freebsd.org (Postfix) with ESMTP id B737B137 for ; Fri, 15 Feb 2013 10:57:13 +0000 (UTC) Received: from omta15.emeryville.ca.mail.comcast.net ([76.96.30.71]) by qmta07.emeryville.ca.mail.comcast.net with comcast id 0aw81l0031Y3wxoA7axBRH; Fri, 15 Feb 2013 10:57:11 +0000 Received: from koitsu.strangled.net ([67.180.84.87]) by omta15.emeryville.ca.mail.comcast.net with comcast id 0axA1l00M1t3BNj8baxBsj; Fri, 15 Feb 2013 10:57:11 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id ADDE073A1C; Fri, 15 Feb 2013 02:57:10 -0800 (PST) Date: Fri, 15 Feb 2013 02:57:10 -0800 From: Jeremy Chadwick To: Alfred Bartsch Subject: Re: some issues with /usr/sbin/service Message-ID: <20130215105710.GA6130@icarus.home.lan> References: <511E0D43.6070900@dssgmbh.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <511E0D43.6070900@dssgmbh.de> User-Agent: Mutt/1.5.21 (2010-09-15) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1360925831; bh=xYVjahJf+ynRDVEWPQh+z7Ubn19h9dJoBRcExxL6W9I=; h=Received:Received:Received:Date:From:To:Subject:Message-ID: MIME-Version:Content-Type; b=QvyOvIcSbnKgGEof4mvfU7OHzNRZzh9ZzF1RqGB8aHnruPIkuv6ax1JBwm8DXO6LQ s2CwId04tswGe2jcJpeXIXTmaBhdRMvpoGCKcgTUeuwZVP74+8bG9kA7M7qanA+02E IjwVYG93OMF9TDR2MD1yFn80D7A1aIqgz9kN4LpMKR4uSmSsMaMov5qfKyXcTwHB8Q wuOUjEHNgf8BHIaWRTdI9wq1C6nTzL9z0UMacJhzPpxRXZrWHBNp2aovXiaogGcq3E yUB2xiFOyIBVrHCmDprygppLk12lQ29QfEG3/lx9BozHmhqVbPtp6t7H04kF9Syi07 w3nVZje0WOFbQ== Cc: freebsd-stable@FreeBSD.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Feb 2013 10:57:14 -0000 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: $_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. :-) If there are ports (or worse, rc.d scripts) out there which recommend xxx_enable variables with non-permitted values, then these ports need to be fixed, not rc.subr(8) nor service(8). Please disclose what those are so they can be fixed. However, "service -e" does not emit warnings on my 2 systems: root@icarus:~ # service -e /etc/rc.d/hostid /etc/rc.d/zvol /etc/rc.d/ddb /etc/rc.d/hostid_save /etc/rc.d/zfs /etc/rc.d/cleanvar /etc/rc.d/ip6addrctl /etc/rc.d/devd /etc/rc.d/netwait /etc/rc.d/newsyslog /etc/rc.d/syslogd /etc/rc.d/named /etc/rc.d/ntpdate /etc/rc.d/dmesg /etc/rc.d/virecover /etc/rc.d/motd /etc/rc.d/ntpd /etc/rc.d/powerd /usr/local/etc/rc.d/samba /usr/local/etc/rc.d/postfix /usr/local/etc/rc.d/mysql-server /usr/local/etc/rc.d/apache22 /etc/rc.d/sshd /etc/rc.d/cron /etc/rc.d/mixer /etc/rc.d/inetd /etc/rc.d/gptboot root@omake:~ # service -e /etc/rc.d/hostid /etc/rc.d/ddb /etc/rc.d/hostid_save /etc/rc.d/cleanvar /etc/rc.d/ip6addrctl /etc/rc.d/devd /etc/rc.d/pflog /etc/rc.d/pf /etc/rc.d/netwait /etc/rc.d/newsyslog /etc/rc.d/syslogd /etc/rc.d/named /etc/rc.d/ntpdate /etc/rc.d/dmesg /etc/rc.d/virecover /etc/rc.d/motd /etc/rc.d/ntpd /usr/local/etc/rc.d/sa-spamd /usr/local/etc/rc.d/postfix /usr/local/etc/rc.d/dovecot /usr/local/etc/rc.d/apache22 /etc/rc.d/sshd /etc/rc.d/cron /etc/rc.d/mixer /etc/rc.d/inetd /etc/rc.d/gptboot Regardless: the permitted values (see above) should be documented in rc.conf(5) somewhere; I don't see any values other than "yes" documented, but I'm probably overlooking it. > 2) "service -e" does not show ALL enabled services, but only those who > are explicitly enabled in /etc/defaults/rc.conf or /etc/rc.conf. > Is that expected behavior? It is the expected behaviour as I understand it per the man page. You should also see rc(8). As I understand it, an "enabled service" is not a process that's running, but something that has a yes/true/on/1 value for its xxx_enabled variable in rc.conf/related file. That's just how it works. If you're used to, for example, Solaris "svcs" then yes things are different here. > To catch all enabled services where the _enabled variable is set > within the service procedure itself, perhaps a call like "service > status" could help. There is already "service status". See rc(8) (search for "status") or try it yourself on a running service. Example: root@icarus:~ # service postfix status postfix is running as pid 1378. Can you rephrase or give an example of what you want? -- | Jeremy Chadwick jdc@koitsu.org | | UNIX Systems Administrator http://jdc.koitsu.org/ | | Mountain View, CA, US | | Making life hard for others since 1977. PGP 4BD6C0CB |