Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Sep 2002 09:19:47 -0500
From:      Sean Kelly <smkelly@zombie.org>
To:        Peter Pentchev <roam@ringlet.net>
Cc:        Paolo <paolo@linux.netline.it>, freebsd-hackers@freebsd.org
Subject:   Re: to log the output of rc scripts
Message-ID:  <20020903141946.GA49976@edgemaster.zombie.org>
In-Reply-To: <20020903102119.GC39422@straylight.oblivion.bg>
References:  <20020902183524.A69527@linux.netline.it> <20020903102119.GC39422@straylight.oblivion.bg>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Sep 03, 2002 at 01:21:19PM +0300, Peter Pentchev wrote:
> On Mon, Sep 02, 2002 at 06:35:24PM +0200, Paolo wrote:
> > Hi all!
> > 	I need to administer remotely a bunch of freebsd boxes. I would
> > be very useful to have access to the output of the rc scripts to see, for
> > example, if a cvsup session has worked correctly...
> > Is it there an option to force logging the output of the rc scripts?
> > Would it be useful if I started working on the subject?
> 
> I believe that, in general, 'dmesg -a' should do what you want.  A quick
> and easy solution, off the top of my head, would be to add an
> /usr/local/etc/rc.d/ZZZZZZZZ.savemessages.sh script, which does
> something like dmesg -a > /var/log/dmesg-afterboot.log or the like.

Actually, I think a nice feature of rcNG is being overlooked here. At work,
I deal with HP-UX machines (*ducks).  When we write rc scripts for them, we
have to have four argument cases in the script:
     * start - Run the actual command.
     * stop - Stops the daemon/process/whatever
     * start_msg - Outputs a single line description
     * stop_msg - Outputs a single line description

For example:
case $1 in
start_msg)
        echo "Start print spooler"
        ;;
stop_msg)
        echo "Stop print spooler"
        ;;
'start')
	  ...
        ;;
'stop')
	  ...
        ;;

The end result of this is an /etc/rc.log generated by the rc scripts during
boot which looks something like this:

Start print spooler
Output from "/sbin/rc2.d/S720lp start":
----------------------------
scheduler is running
line printer scheduler started

Start clock daemon
Output from "/sbin/rc2.d/S730cron start":
----------------------------
cron started

Basically, rc.log consists of the (start|stop)_msg line, followed by the
name of the script that generated it, and then stdout/stderr of the actual
process run by the (start|stop) case.  In the end, you end up with an
/etc/rc.log that shows the progress of your entire boot, and is finished
with:

**************************************************
HP-UX run-level transition completed
Fri Aug 30 20:11:56 CDT 2002
**************************************************

I'm not saying rcNG should have a (start|stop)_msg thing, but I would like
to see it log the output of stuff that it runs when booting and changing
runlevels.

-- 
Sean Kelly         | PGP KeyID: 77042C7B
smkelly@zombie.org | http://www.zombie.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020903141946.GA49976>