On Mon, 01 Feb 2010 22:43:56 +0100, Doug Barton <[email protected]> wrote:

pgollucci    2010-02-01 17:45:31 UTC

Philip, Boris, thanks for your work! Doug, thanks for your review of my little change and the rest of the rc script.

There is a better way to accomplish what this change does which I
included in the attached patch.

I think it isn't better way. Return value is OK, but commands aren't called for all daemons. Your script halts on first error but I think for example stopping already stopped daemon shouldn't prevent another daemon from being stopped.

 Let's assume following configuration:

# grep quagga /etc/rc.conf
quagga_daemons="zebra ripd ripngd ospfd bgpd"

# cd /usr/local/etc/rc.d/

./quagga.am -- my rc script
./quagga.dougb -- Doug's rc script

 Consider following scenarios:

Scenario #1 (ripngd stopped)
We want to know which daemons are running

# ./quagga.dougb onestatus
zebra is running as pid 74504.
ripd is running as pid 74352.
ripngd is not running.

but...

# ./quagga.am onestatus
zebra is running as pid 74504.
ripd is running as pid 74352.
ripngd is not running.
ospfd is running as pid 74386.
bgpd is running as pid 74402.

Scenario #2 (zebra and ospfd stopped)

Something is wrong. Let's check:
# ./quagga.dougb onestatus
zebra is not running.

Ok, my quagga is turned off. Let's turn it on:

# ./quagga.dougb onestart
Starting zebra.
ripd already running? (pid=74352).

Confusing, but OK -- one process is started, another was already started -- my quagga is now started.

but...

# ./quagga.am onestatus
zebra is running as pid 74950.
ripd is running as pid 74352.
ripngd is running as pid 74901.
ospfd is not running.
bgpd is running as pid 74402.

# pkill zebra

# ./quagga.am onestatus
zebra is not running.
ripd is running as pid 74352.
ripngd is running as pid 74901.
ospfd is not running.
bgpd is running as pid 74402.

# ./quagga.am onestart
Starting zebra.
ripd already running? (pid=74352).
ripngd already running? (pid=74901).
Starting ospfd.
bgpd already running? (pid=74402).

Scenario #3 (zebra stopped)

OK, I don't want to play with quagga anymore. Stop it:

# ./quagga.dougb onestop
zebra not running? (check /var/run/quagga/zebra.pid).

Uff! But...

# ./quagga.am onestatus
zebra is not running.
ripd is running as pid 75192.
ripngd is running as pid 74901.
ospfd is running as pid 75080.
bgpd is running as pid 74402.

# ./quagga.am onestop
zebra not running? (check /var/run/quagga/zebra.pid).
Stopping ripd.
Stopping ripngd.
Stopping ospfd.
Stopping bgpd.

Etc, etc...

Regarding the other changes:

1. (Hopefully) improve readability for the comments
2. Add quagga_extralibs_path to the comments, some description should be
included there instead of "blah blah." :)  The reason for this is that
the default empty variable assignments have been removed (they are
neither necessary nor desirable).
3. The construction "while true; do" is usually safe, but better to use
the shell internal way of saying the same thing.
4. Make $daemon in do_cmd local

 I think rest of the changes are appropriate.

--
am
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to