some issues with /usr/sbin/service
Alfred Bartsch
bartsch at dssgmbh.de
Fri Feb 15 10:35:02 UTC 2013
-----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: $<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:
- --- 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 <name>_enabled variable is set
within the service procedure itself, perhaps a call like "service
<name> 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-----
More information about the freebsd-stable
mailing list