Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Aug 1999 21:20:23 -0700
From:      Doug <Doug@gorean.org>
To:        "Stephen J. Roznowski" <sjr@home.net>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: How bullet-proof should the /etc/rc* scripts be?
Message-ID:  <37C61207.CD381903@gorean.org>
References:  <199908270221.WAA14818@cc158233-a.catv1.md.home.com>

next in thread | previous in thread | raw e-mail | index | archive | help
"Stephen J. Roznowski" wrote:
> 
> I'm trying to build a stripped down version of FreeBSD and have run
> across a few oddities in the startup scripts.

	Ok, first thing is, if you are going to hack up some custom stuff you're
pretty much in the driver's seat on issues like this. That's not to say
that the rc*, etc. scripts couldn't use some work, in fact some of us are
doing just that. 

> 1. Should commands be wrapped in a check for their existance? For
>    example: swapon, adjkerntz, etc.

	If failed execution of the command will leave the system in an unusable
state, yes. (Assuming by "check for their existance" you mean using the -x
flag to 'test'.) If the system can continue booting even if the command
fails, but the user needs to know the command failed, you should test the
exit code and act appropriately. If no one cares about the command you
don't need to do this, but then why run it at all?
 
> 2. Should everything be wrapped in a "rc.conf" variable? For example,
>    the section with "mount -a -t nfs" (even though it silently exists
>    if no NFS filesystems exist).

	No. That specific case refers to entries in /etc/fstab (the -a is your
clue), so regardless of the presence or abscence of nfs stuff in rc.conf
that command should be run. There are other commands like this, especially
in rc.network that fall into the "we can just run this and nothing bad will
happen if we don't need it" category. In a situation like yours that's bad,
and in general I'm for making *less* assumptions about the state of the
system, but you have to start _somewhere_. 
 
> 3. How much checking should be done before executing commands? As it
>    stands now, if you don't have any ptys, the chflags/chmod/chown
>    will fail -- should this be wrapped with an if statement?

	This is a little tougher. I would say that having NO pty's at all is a
rather extreme case, but while I'm doing the review I'll give this another
look. Can you send me the filename and line number of this specific case in
a private e-mail please? That way I won't miss it. 
 
> 4. What is the point of the "stty status '^T' at the top of the rc file?

	Frankly, that one stumps me too. :) There are still plenty of "We've
always done it that way" items in the various rc files, that may be one of
them. 

	In answer to the question in your subject line, I would say "More so than
they are now." Comments and suggestions are welcome, preferably accompanied
by unified diffs. :)

Good luck with your project, 

Doug


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?37C61207.CD381903>