Replacing rc(8) (Was: FreeBSD Boot Times)
Freddie Cash
fjwcash at gmail.com
Wed Jun 20 21:42:50 UTC 2012
On Wed, Jun 20, 2012 at 1:28 PM, Daniel Robbins <drobbins at funtoo.org> wrote:
> On Wed, Jun 20, 2012 at 2:22 PM, Daniel Robbins <drobbins at funtoo.org> wrote:
>>
>> This doesn't change the "hard" runlevel (3) but it changes the OpenRC
>> logical runlevel. Basically, this convenient system is compatible with
>> traditional linux numerical runlevels but does depend on them.
>>
>
> Meant to type: "does NOT depend on them".
>
> Here is a bit more info:
>
> Runlevel-specific conf.d files:
>
> http://www.funtoo.org/wiki/Funtoo_Linux_Networking#Alternate_Configs
>
> Stacked runlevels (this is a more sophisticated feature than just
> creating a duplicate, separately-managed runlevel):
>
> http://www.funtoo.org/wiki/Stacked_Runlevels
>
> To create a separately-managed runlevel, you would just:
>
> # mkdir /etc/runlevels/maintenance
> # rc-update add maintenance svc1
> # rc-update add maintenance svc2
> # rc-update add maintenance svc1
>
> You could then switch by typing:
>
> # rc maintenance
>
> Anything not in the maintenance runlevel that is currently running
> would be stopped, and any new services in maintenance that are not
> running would be started.
There's no need to do a wholesale replacement of the RC system in
FreeBSD to support this concept. What you are describing are "service
profiles". And we already have a single file that describes the
default "service profile" for FreeBSD: /etc/rc.conf. That lists
every service that should be started (or stopped).
All that's missing is a way to tell the RC system to use a different
rc.conf file (like rc.conf.mobile, or rc.conf.wireless or
rc.conf.whatever), and to run through the RC setup based on that file.
Our current RC system does everything needed except:
- parallel execution of items that don't depend on each other
- monitor running services and restart them if they crash
Compared to all the init/RC systems on Linux, ours has *many*
advantages, not the least of which are:
- very simple text configuration file
- only 2 directories of init scripts to worry about (/etc/rc.d;
/usr/local/etc/rc.d)
- ability to create "generic" or global config file (/etc/rc.conf)
with local overrides (/etc/rc.conf.local)
- ability to see the exact order that things will start (or stop) via rcorder
- everything is written in nice, simple, sh
We don't need to replace a perfectly working system. Maybe it needs
improving, but it doesn't need replacing.
--
Freddie Cash
fjwcash at gmail.com
More information about the freebsd-hackers
mailing list