tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: rc scripts telling you when they will not start



On Sat, 7 Jan 2012, matthew sporleder wrote:

One thing that has always bothered me about netbsd rc is that running
an rc script will often silently do nothing.

If a service is turned NO by default in /etc/defaults/rc.conf, and you
run /etc/rc.d/foo start, you get nothing + a 0 return status.

The following patch gives a nice little messages:

--- rc.subr-bak 2012-01-07 09:22:36.000000000 -0500
+++ rc.subr     2012-01-07 10:13:49.000000000 -0500
@@ -55,6 +55,7 @@

               #       "no", "false", "off", or "0"
       [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
+               warn "\$${1} is set to $_value - not running $1."
               return 1
               ;;
       *)

rc.d # /etc/rc.d/named start
/etc/rc.d/named: WARNING: $named is set to NO - not running named.
rc.d # /etc/rc.d/named ftpd start
/etc/rc.d/named: WARNING: $named is set to NO - not running named.

The issues I haven't addressed are the return status, which I think
should be non-zero.

Why should it be non-zero? Not everyone, for example, would want a warning status if their file-server happened to have xdm=NO, or if their laptop has nfsd=NO

Also, I guess this would make the boot kind of noisy.  Could we add
something like:
(/etc/rc)
-        run_rc_script $_rc_elem start
+        run_rc_script $_rc_elem start silent

and then test if the boot rc_arg has 'silent' before printing the warning?

I would prefer to keep current default behavior, and add a new 'verbose' option instead:

-        run_rc_script $_rc_elem start
+        run_rc_script $_rc_elem start verbose



-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index