Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Booting with runit

The first tu­to­ri­al com­ing from my cus­tom-dis­tro ex­per­i­ments. Since it's a good idea to start at the be­gin­ning, here is... Boot­ing with runit.

Saem / 2006-04-03 15:50:

I was curious about something. Is there a better way to generalize services?



For instance, assume a service x, with requirements a and b. Assume there are more than one services which can satisfy these requirements. All of them are authored and distributed by separate groups and so there isn't necessarily a lot of awareness about each other.



It seems to me that service x would explicitly be required to know about services that fulfill the requirements a and b. Or meta-services are made, called a and b, which can then be used by service x. Neither of these seem particularly nice.



Is there a facility for services to query the system for fulfillment of a set of requirements? Requirements would of course require standardized names, but that shouldn't be too hard. Administrators could either pass the service an argument telling it to explicitly fulfill all or some of its requirements with a particular service(s) or could setup a prioritized list of which services to use. Intelligent defaults will be a must and likely up to the distribution.

Roberto Alsina / 2006-04-03 15:50:

I like the metaservices stuff better.



Suppose you have qmail and sendmail, and a service that requires a mail server, but both would do.



You install the qmail service in /var/qmail/service, sendmail in /var/sendmail/service and link the right one to /var/service/mail



Then, make stuff depend on /var/service/mail



Standardized service names are part of the LSB, too (I think), so chosing them should be simple.

Markus / 2006-04-03 15:51:

"if someone knows how to get the name of the parent folder in shell scripts, we can make that really universal ;-)"



I am no guru, so dont trust me on this:

Here is a little piece of code I hacked together that seems to do just that. Kick me, if I am wrong ;)

echo `cd .. && pwd | sed 's/.*///'`

laz / 2006-04-03 15:52:

Parent dir in shell:

in zsh you can use ${${PWD%/*}##*/}

in POSIX shell you'll have to use a tmp var:



foo=${PWD%/*}

foo=${foo##*/}



(assuming you get a PWD var ... if not $(pwd) works)

Roberto Alsina / 2006-04-03 15:52:

Ok, here's my version ;-)



parent=`cd .. ; basename $(pwd)`



Will fix the article.

Vincent Danen / 2006-04-03 15:53:

Annvix uses runit by default for all services and comes with a "chkconfig-like" utility called srv for handling the stopping/starting/adding/deleting of services to make things a little simpler.



Every service in Annvix runs via runit although in stage 1 it still calls what few initscripts there are (rather than putting it all into /etc/runit/1); this will change eventually.



To complement the examples on the runit site, anyone can poke through the Annvix CVS to view the run scripts we have.



(I think Annvix is the only distro that is fully runit-enabled out of the box).

Saem / 2006-04-03 16:06:

Okay, meta-services seem more bare-able, now. Considering that there are standards via the LSB and there could be some sane ways to manage it.

Daniel / 2006-04-03 16:36:

Hi!

I think is missing one file. The /etc/runit/3. It is responsable for the shutdown.


Contents © 2000-2024 Roberto Alsina