From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 18 11:57:27 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32415106566C for ; Mon, 18 Apr 2011 11:57:27 +0000 (UTC) (envelope-from rank1seeker@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id AD1C08FC0A for ; Mon, 18 Apr 2011 11:57:26 +0000 (UTC) Received: by bwz12 with SMTP id 12so5126611bwz.13 for ; Mon, 18 Apr 2011 04:57:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:from:to:subject:date:content-type :content-transfer-encoding:in-reply-to:references:x-mailer; bh=qL5kojwqMehOZnchSLrRSbCwB7Esgao82Uc4RTzu1zM=; b=IUBNZ5VZ2WAGvtwHtFxZQrP737zZ9dtKLOAKm0mZ2GyJD56n9V9tKG39Ns7paffiQm OvbZKnDSV244e0VovRlpzry1T3gUw9u+KsobQYIwl7bAygGC6wy0iIOC7vvvYdMYXZed Dc40IvaesYj/styrohMjnEylr0vywl6tdTGbs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:subject:date:content-type :content-transfer-encoding:in-reply-to:references:x-mailer; b=FXQUd7XcI3fJoQGBJnkcDa+XSGTcuZ6vaP7B5S44bw80IwFAZhvKyEI0/lABSLyeJC 3Athwk0bEO99BUiqIfMVDahC8OpxppzBw0KujI3ycnoGpjotTlEusBzkeNTXiOt+ajmZ LcwC0X9nbIZiFayoJxLMzw217QISD+1bNasi8= Received: by 10.204.84.166 with SMTP id j38mr4091058bkl.84.1303127844810; Mon, 18 Apr 2011 04:57:24 -0700 (PDT) Received: from DEV (93-141-110-103.adsl.net.t-com.hr [93.141.110.103]) by mx.google.com with ESMTPS id a23sm3111228bkc.16.2011.04.18.04.57.22 (version=SSLv3 cipher=OTHER); Mon, 18 Apr 2011 04:57:23 -0700 (PDT) Message-ID: <20110418.115215.546.1@DEV> From: rank1seeker@gmail.com To: freebsd-hackers@freebsd.org Date: Mon, 18 Apr 2011 13:52:15 +0200 Content-Type: text/plain; charset="Windows-1250" Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <8CDCA9824BFE47E-176C-A720@web-mmc-d04.sysops.aol.com> <20110416233839.GA72223@DataIX.net> X-Mailer: POP Peeper (3.7.0.0) Subject: Re: Add SUM sysctl X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2011 11:57:27 -0000 I would like, to thank you all, for your ideas.=0D=0A=0D=0AThere are 2 ways = of going into SUM (Single user mode)=0D=0A1) Rebooting into it=0D=0A2) = Drop from MUM=0D=0A=0D=0AMy solution MUST cover both cases, of entering = into SUM.=0D=0A=0D=0AOnce 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 ...)=0D=0ANow, after those steps, if = that machine is web server, which serves only static content, then = enabling apache, makes it fully functional server, in SUM!=0D=0AI see = now, that both SUM and MUM define BOOTED/STARTED/RUNNING FreeBSD. -> = Thx, to Daniel O'Connor, for pointing into this direction.=0D=0ASo SUM = defines basic functionality and MUM ...=0D=0ASo where is a BORDER of SUM = and MUM. How many "stuff" has to be enabled/activated to decalre it as = MUM, instead of SUM?=0D=0AWhere does exactly SUM, becomes MUM. As long as = kernel is being asked, it doesn't differentiate between SUM and = MUM.=0D=0AKernel "sees" amonut of "pressure" induced by deamones, users, = processes.=0D=0A=0D=0ANow to cut that chatter short, to solution = ...=0D=0A=0D=0AI've tried by looking at init state:=0D=0A# ps -U root | = grep 'init -s'=0D=0ABUT, after exiting into MUM, from SUM:=0D=0ASUM->MUM = (/sbin/init -s) 'init -s' remained.=0D=0AIf sys booted directly into MUM, = I see (/sbin/init --), which also remains upon drop to SUM.=0D=0ASo init = state can only be used, to determine, how sys has been = booted/started.=0D=0A=0D=0ATo cut it even shorter (skipping tried sysctl = vars, env, etc ...)=0D=0A=0D=0A=0D=0ASolution, which passed my = requirement, was one from J. Hellenthal's advice.=0D=0AThx!=0D=0AIt = works, with both cases of entering into SUM.=0D=0AAlso covers case, where = I enable stuff, that I need in SUM and which could confuse function, into = thinking it is in MUM.=0D=0A=0D=0A=0D=0AHere is an resulting function: = (/bin/sh)=0D=0A--=0D=0A# Are we in a SUM=0D=0Ain_sum ()=0D=0A{=0D=0A = if [ "`/bin/pgrep -x getty`" ]; then=0D=0A return 1=0D=0A = else=0D=0A return 0=0D=0A = fi=0D=0A}=0D=0A--=0D=0A=0D=0A=0D=0ADomagoj Smol=E8i=E6=0D=0A