supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* Initial runlevel through kernel parameters
@ 2007-04-27 16:41 Mike Buland
  2007-04-28  0:33 ` Alejandro Mery
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Buland @ 2007-04-27 16:41 UTC (permalink / raw)
  To: supervision

Hello,

I would like to be able to set the default runlevel from the kernel loader 
(grub, lilo) as a command line parameter while using runit-init.  This is 
quite handy, being able to specify an S for single, or 3 for console-only, 
etc.

I've been looking around, and I was just wondering if anyone can point me in 
the right direction to set this up.  Once realized, I would be happy to write 
up some docs about how to accomplish this.

I don't really care how it has to be done, I just know that, especially on my 
laptop and some servers there are times when we don't want a lot of extra 
overhead for specialized tasks and maintenence-boots.

Is this possible?

Thanks,
--Mike


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Initial runlevel through kernel parameters
  2007-04-28  0:33 ` Alejandro Mery
@ 2007-04-27 21:04   ` Mike Buland
  2007-04-27 21:09     ` Alex Efros
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Buland @ 2007-04-27 21:04 UTC (permalink / raw)
  To: supervision

That's so simple and obvious, I don't really know what to say.  Thank you so 
much for your prompt and useful help!

Thanks,
--Mike

On Friday 27 April 2007 06:33:18 pm Alejandro Mery wrote:
> Am 2007-04-27 schrieb Mike Buland <mike@geekgene.com>:
> > Is this possible?
>
> in linux to parse the command line is as simple as:
> set -- $( cat /proc/cmdline )
> for x; do
> 	case "$x" in
> 		whatever=*)	echo "$x"	;;
> 	esac
> done
>
> taking the value from there can be used at /etc/runit/1 to take
> decisions, like the initial runlevel.
>
> Alejandro Mery




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Initial runlevel through kernel parameters
  2007-04-27 21:04   ` Mike Buland
@ 2007-04-27 21:09     ` Alex Efros
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Efros @ 2007-04-27 21:09 UTC (permalink / raw)
  To: supervision

Hi!

On Fri, Apr 27, 2007 at 03:04:32PM -0600, Mike Buland wrote:
> > in linux to parse the command line is as simple as:
> > set -- $( cat /proc/cmdline )
> That's so simple and obvious, I don't really know what to say.  Thank you so 
> much for your prompt and useful help!

Actually in /etc/runit/1 you ALREADY have kernel params available as
environment variables. For example, I add param 'runlevel=console' to
kernel and then I can just do in /etc/runit/1:

    runsvchdir $runlevel

Full version of my support for runlevels from /etc/runit/1 is here:

    # Set runlevel to:
    # - single	     if kernel has param: S
    # - RUNLEVELNAME if kernel has param: runlevel=RUNLEVELNAME
    # - default	     if kernel has no params or unable to set requested runlevel
    grep -q '\(^\| \)S\( \|$\)' /proc/cmdline && runlevel='single'
    runsvchdir ${runlevel:-default} || runsvchdir default

-- 
			WBR, Alex.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Initial runlevel through kernel parameters
  2007-04-27 16:41 Initial runlevel through kernel parameters Mike Buland
@ 2007-04-28  0:33 ` Alejandro Mery
  2007-04-27 21:04   ` Mike Buland
  0 siblings, 1 reply; 4+ messages in thread
From: Alejandro Mery @ 2007-04-28  0:33 UTC (permalink / raw)
  To: supervision

[-- Attachment #1: Type: text/plain, Size: 435 bytes --]

Am 2007-04-27 schrieb Mike Buland <mike@geekgene.com>:
> Is this possible?

in linux to parse the command line is as simple as:
set -- $( cat /proc/cmdline )
for x; do
	case "$x" in
		whatever=*)	echo "$x"	;;
	esac
done

taking the value from there can be used at /etc/runit/1 to take
decisions, like the initial runlevel.

Alejandro Mery


-- 
GPG/PGP: DA23A600 / 19F7 C16C 14FA B29F 36A6  0588 FE44 6717 DA23 A600

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-28  0:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-27 16:41 Initial runlevel through kernel parameters Mike Buland
2007-04-28  0:33 ` Alejandro Mery
2007-04-27 21:04   ` Mike Buland
2007-04-27 21:09     ` Alex Efros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).