[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: When to trust compound statements and when to test? was: restart all services?



On Sat, Jun 08, 2002 at 07:41:30PM -0500, Gary Turner wrote:
| On Sat, 08 Jun 2002 15:07:10 -0700, Karsten M. Self wrote:
| 
| <snip>
| >
| >If you can bounce the system, issue a shutdown to maintenance, and then
| >back up to full services.  That's not a system restart, but rather stops
| >all user and daemon processes, then restarts them.
| >
| >If that's too drastic:
| >
| >   $ for file in /etc/rc2.d/S*; do $file stop; $file start; done
| 
| Is there a rule of thumb to determine when sequential commands should be
| trusted and when  they should be tested? 

The result should be tested when you care about it.

| In the above example, if the
| stop command does not exit 0, is any harm done by going into the start
| command?

Probably not.  In fact, sometimes that is desired -- the stop command
will often exit with an error status if the daemon wasn't already
running, and in this case you want to start it again anyways.

| What should I look for that would suggest the need for testing; eg.,
| "do $file stop && $file start;"  The possibility exists (citing
| extreme shell ignorance) that I'm totally off base even bringing up
| the question.

You look for the situation where an error in an earlier command means
that you shouldn't execute the second command.  It all depends on what
the commands are and what the errors mean and what you want to do
about them.

-D

-- 

Better a little with righteousness
than much gain with injustice.
        Proverbs 16:8
 
GnuPG key : http://dman.ddts.net/~dman/public_key.gpg

Attachment: pgp1IdlVaLuoj.pgp
Description: PGP signature


Reply to: