From owner-freebsd-stable@FreeBSD.ORG Fri Feb 15 10:35:02 2013 Return-Path: Delivered-To: freebsd-stable@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8B252AD6 for ; Fri, 15 Feb 2013 10:35:02 +0000 (UTC) (envelope-from bartsch@dssgmbh.de) Received: from dss.incore.de (dss.incore.de [195.145.1.138]) by mx1.freebsd.org (Postfix) with ESMTP id 41582F60 for ; Fri, 15 Feb 2013 10:35:02 +0000 (UTC) Received: from inetmail.dmz (inetmail.dmz [10.3.0.3]) by dss.incore.de (Postfix) with ESMTP id 8BF6F5E611 for ; Fri, 15 Feb 2013 11:26:15 +0100 (CET) X-Virus-Scanned: amavisd-new at incore.de Received: from dss.incore.de ([10.3.0.3]) by inetmail.dmz (inetmail.dmz [10.3.0.3]) (amavisd-new, port 10024) with LMTP id QdqoDNrnNifh for ; Fri, 15 Feb 2013 11:26:11 +0100 (CET) Received: from mail.incore (fwintern.dmz [10.0.0.253]) by dss.incore.de (Postfix) with ESMTP id 918415E60C for ; Fri, 15 Feb 2013 11:26:11 +0100 (CET) Received: from pcadmin.incore (pcadmin.incore [192.168.0.140]) by mail.incore (Postfix) with ESMTPSA id 8A3C050857 for ; Fri, 15 Feb 2013 11:26:11 +0100 (CET) Message-ID: <511E0D43.6070900@dssgmbh.de> Date: Fri, 15 Feb 2013 11:26:11 +0100 From: Alfred Bartsch User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:7.0.1) Gecko/20111007 Thunderbird/7.0.1 MIME-Version: 1.0 To: freebsd-stable@FreeBSD.org Subject: some issues with /usr/sbin/service X-Enigmail-Version: undefined Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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:35:02 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, 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: - --- service.orig 2013-02-10 20:01:14.000000000 +0100 +++ service 2013-02-15 08:51:30.000000000 +0100 @@ -28,6 +28,28 @@ . /etc/rc.subr load_rc_config 'XXX' +# +# checkyes var +# Test $1 variable. +# Return 0 if it's "yes" (et al), nonzero otherwise. +# +checkyes() +{ + eval _value=\$${1} + debug "checkyes: $1 is set to $_value." + case $_value in + + # "yes", "true", "on", or "1" + [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) + return 0 + ;; + + # everything else + *) + return 1 + ;; + esac +} usage () { echo '' @@ -100,7 +122,7 @@ if grep -q ^rcvar $file; then eval `grep ^name= $file` eval `grep ^rcvar $file` - - checkyesno $rcvar 2>/dev/null && echo $file + checkyes $rcvar 2>/dev/null && echo $file fi done exit 0 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? To catch all enabled services where the _enabled variable is set within the service procedure itself, perhaps a call like "service status" could help. - -- Regards Alfred Bartsch Data-Service GmbH -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlEeDUMACgkQ5QGe2JdVf3hL5QCggTK3JP9A+ZybIX/iCsuqu5Ic bYQAn2w7Y2klRoEy7ithoxeVcl4xA2be =QJmh -----END PGP SIGNATURE-----