Add SUM sysctl

rank1seeker at gmail.com rank1seeker at gmail.com
Mon Apr 18 11:57:27 UTC 2011


I would like, to thank you all, for your ideas.

There are 2 ways of going into SUM (Single user mode)
1) Rebooting into it
2) Drop from MUM

My solution MUST cover both cases, of entering into SUM.

Once I enter SUM, I set it up, via 1 script, which enables deamons and other stuff, that I need, for certain task. (i.e; I wana use mouse, so I activate moused ...)
Now, after those steps, if that machine is web server, which serves only static content, then enabling apache, makes it fully functional server, in SUM!
I see now, that both SUM and MUM define BOOTED/STARTED/RUNNING FreeBSD.  -> Thx, to Daniel O'Connor, for pointing into this direction.
So SUM defines basic functionality and MUM ...
So where is a BORDER of SUM and MUM. How many "stuff" has to be enabled/activated to decalre it as MUM, instead of SUM?
Where does exactly SUM, becomes MUM. As long as kernel is being asked, it doesn't differentiate between SUM and MUM.
Kernel "sees" amonut of "pressure" induced by deamones, users, processes.

Now to cut that chatter short, to solution ...

I've tried by looking at init state:
# ps -U root | grep 'init -s'
BUT, after exiting into MUM, from SUM:
SUM->MUM (/sbin/init -s) 'init -s' remained.
If sys booted directly into MUM, I see (/sbin/init --), which also remains upon drop to SUM.
So init state can only be used, to determine, how sys has been booted/started.

To cut it even shorter (skipping tried sysctl vars, env, etc ...)


Solution, which passed my requirement, was one from J. Hellenthal's advice.
Thx!
It works, with both cases of entering into SUM.
Also covers case, where I enable stuff, that I need in SUM and which could confuse function, into thinking it is in MUM.


Here is an resulting function: (/bin/sh)
--
# Are we in a SUM
in_sum ()
{
    if [ "`/bin/pgrep -x getty`" ]; then
        return 1
    else
        return 0
    fi
}
--


Domagoj Smolčić



More information about the freebsd-hackers mailing list