From owner-freebsd-arch@FreeBSD.ORG Mon Sep 15 02:08:20 2014 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CA02D91A; Mon, 15 Sep 2014 02:08:20 +0000 (UTC) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id 5EE1C691; Mon, 15 Sep 2014 02:08:20 +0000 (UTC) Received: from [10.0.0.185] (c-24-125-214-90.hsd1.va.comcast.net [24.125.214.90]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 1A1BF56447; Sun, 14 Sep 2014 21:08:18 -0500 (CDT) Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: Trouble with freebsd rc system. From: Eric van Gyzen In-Reply-To: <54161C50.3000507@freebsd.org> Date: Sun, 14 Sep 2014 22:08:16 -0400 Message-Id: <9B16D77C-0FD9-4A7B-AA13-009D0FC3A511@vangyzen.net> References: <54161633.60207@freebsd.org> <1410734453.66615.2.camel@revolution.hippie.lan> <54161C50.3000507@freebsd.org> To: Alfred Perlstein X-Mailer: Apple Mail (2.1878.6) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: arch@freebsd.org, Ian Lepore X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Sep 2014 02:08:20 -0000 On Sep 14, 2014, at 6:53 PM, Alfred Perlstein = wrote: >=20 > On 9/14/14, 3:40 PM, Ian Lepore wrote: >> On Sun, 2014-09-14 at 15:26 -0700, Alfred Perlstein wrote: >>> Hey folks, >>>=20 >>> We are building an appliance based on FreeBSD. >>>=20 >>> One of the issues we have is that during development we need to know >>> which rc script we are in during boot so that if something is = hanging or >>> otherwise misbehaving we know which script it is. >>>=20 >>> I am contemplating this hack to /etc/rc.subr's run_rc_command() = method: >>>=20 >>> run_rc_command() >>> { >>> _return=3D0 >>> rc_arg=3D$1 >>> if [ -z "$name" ]; then >>> err 3 'run_rc_command: $name is not set.' >>> fi >>>=20 >>> # Don't repeat the first argument when passing additional = command- >>> # line arguments to the command subroutines. >>> # >>> shift 1 >>> rc_extra_args=3D"$*" >>>=20 >>> echo "=3D=3D=3D> $name $rc_arg" >>>=20 >>>=20 >>> As you can see I've added the call to echo so we know where we are. >>>=20 >>> This is somewhat suboptimal because we really only want that output >>> during startup. >>>=20 >>> So a few questions: >>>=20 >>> 1. Is there a way to know we are booting when inside of >>> /etc/rc.subr:run_rc_command() ? >>> 2. Is there a magic thing I'm missing that does what I want (output >>> which /etc/rc.d/ script I am about to run)? >>> 3. How would I make a knob to turn off the "echo" so that I can >>> contribute this back to FreeBSD without getting into a bikeshed on >>> bootup messages. >>>=20 >>> Kindly please advise. >>>=20 >>> -Alfred >> A bit further down in run_rc_command, in the start) case, is: >>=20 >> check_startmsgs && echo "Starting ${name}." >>=20 >> and that output is controlled with rc_startmsgs=3Dyes, which is the >> default. >>=20 >> -- Ian >>=20 >>=20 >>=20 > I see that, however I've often been hung up in a rc script and that = message is not displayed... let me check, maybe we have dumb defaults = somehow. run_rc_script() sets up a signal hander for SIGINFO, so you can type = Ctrl-T to see which script is currently running. Eric=