8.0 rc.d scripts less verbose?
Doug Barton
dougb at FreeBSD.org
Thu Sep 17 10:42:42 UTC 2009
Please follow up to this post on the freebsd-rc at freebsd.org list, thanks.
See below for my comments.
Ian Smith wrote:
> On Wed, 16 Sep 2009, Doug Barton wrote:
>> Cezary Morga wrote:
>>> Dimitry Andric pisze:
>>>> Index: etc/rc.subr
>>>> ===================================================================
>>>> --- etc/rc.subr (revision 196888) +++ etc/rc.subr
>>>> (working copy) @@ -680,7 +680,7 @@ run_rc_command()
>>>>
>>>> # setup the full command to run # - [ -z
>>>> "${rc_quiet}" ] && echo "Starting ${name}." + echo
>>>> "Starting ${name}." if [ -n "$_chroot" ]; then _doit="\
>>>> ${_nice:+nice -n $_nice }\
>>>
>>> Wouldn't it be easier to set rc_quiet to zero-length value,
>>> like rc_quiet=""?
>>
>> That actually would give off too much information because
>> rc_quiet suppresses error messages about scripts that don't
>> currently have _enable set to anything useful. That's arguably a
>> bug, but it's a bug that we've come to depend on.
>>
>> The attached patch adds a knob you can set in rc.conf to see
>> "Starting foo" messages again. If people find this useful I'll be
>> glad to commit it. I'm also open to suggestions for a better
>> name.
>
>> From your patch:
> - [ -z "${rc_quiet}" ] && echo "Starting ${name}."
> + [ -z "${rc_quiet}" -o -n "${rc_starting}" ] && echo "Starting
${name}."
>
> Presumably this variable would go in /etc/defaults/rc.conf .. seems
> that all the other rc.conf binary choices are either set "YES" or
> "NO" rather than something or empty, so perhaps more consistent
> with that might be:
>
> [ -z "${rc_quiet}" -o "${rc_starting}" = "YES" ] && echo "Starting
> ${name}."
No, we don't test boolean flags for specific values. I've attached a
proper patch to this message.
> As for name, not fussed, but maybe rc_startmsgs maybe more
> indicative?
That sounds fine to me, if anyone else has a better idea follow up on
the freebsd-rc list.
> Also, I agree with Oliver; YES should probably be the default
> (POLA) so folks annoyed by 'too much information' in console.log
> can disable it.
This late in the release cycle I'm comfortable adding a knob, but I'm
not comfortable toggling the default. If there is consensus on the
freebsd-rc list to make the default "yes" then I will go with that
consensus.
Dimitry Andric wrote:
> On 2009-09-17 09:17, Oliver Fromme wrote:
>> My feeling is that hiding all of the "starting" messages is a
>> regression that needs to be fixed. I cannot think of a good
>> reason why they should be hidden, but there are certainly good
>> reasons to display them.
>
> The commit that introduced this, r179946, has this log message:
>
> ==== Move the diagnostic output when the rc.subr(8) glue
> automatically starts a
> service behind $rc_quiet. Instead, output a warning if the
> pre-command routine or the command itself failed. Arguably, it's
> more useful to know when
> a command failed to start than it is to have an endless list of
> "Starting ...." lines[1].
>
> [1] - This change actually helped me to discover a bug in
> rc.d/{lockd,statd}
> (fixed in r179941) that used to fail silently before. ====
>
> It is really a matter of taste, I guess. There is something to be
> said for eliminating verbosity, in order to make real errors more
> visible.
>
> On the other hand, if one of your startup rc scripts hangs (for
> whatever reason), it is nice to have an approximate idea which one
> it is. :)
I tend to agree that the current default is a little too un-verbose.
If there is support for adding this knob I'll follow up with re@ to
see about getting it into 8.0-release, although I'm not sure how
they'll feel about a change like this so late in the cycle.
Doug
--
This .signature sanitized for your protection
-------------- next part --------------
Index: share/man/man5/rc.conf.5
===================================================================
--- share/man/man5/rc.conf.5 (revision 197259)
+++ share/man/man5/rc.conf.5 (working copy)
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 2, 2009
+.Dd September 17, 2009
.Dt RC.CONF 5
.Os
.Sh NAME
@@ -95,6 +95,13 @@
Informational messages are displayed when
a condition that is not serious enough to warrant a warning or
an error occurs.
+.It Va rc_startmsgs
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+show
+.Dq Starting foo:
+when faststart is used (e.g., at boot time).
.It Va early_late_divider
.Pq Vt str
The name of the script that should be used as the
Index: etc/defaults/rc.conf
===================================================================
--- etc/defaults/rc.conf (revision 197259)
+++ etc/defaults/rc.conf (working copy)
@@ -23,6 +23,7 @@
rc_debug="NO" # Set to YES to enable debugging output from rc.d
rc_info="NO" # Enables display of informational messages at boot.
+rc_startmsgs="NO" # Show "Starting foo:" messages at boot
rcshutdown_timeout="30" # Seconds to wait before terminating rc.shutdown
early_late_divider="FILESYSTEMS" # Script that separates early/late
# stages of the boot process. Make sure you know
Index: etc/rc.subr
===================================================================
--- etc/rc.subr (revision 197259)
+++ etc/rc.subr (working copy)
@@ -708,7 +708,13 @@
# setup the full command to run
#
- [ -z "${rc_quiet}" ] && echo "Starting ${name}."
+ _show_startmsgs=1
+ if [ -n "${rc_quiet}" ]; then
+ if ! checkyesno rc_startmsgs; then
+ unset _show_startmsgs
+ fi
+ fi
+ [ -n "$_show_startmsgs" ] && echo "Starting ${name}."
if [ -n "$_chroot" ]; then
_doit="\
${_nice:+nice -n $_nice }\
More information about the freebsd-rc
mailing list