At 11:52 AM -0600 11/21/96, Jason L Tibbitts III wrote:
>>>>>> "BR" == Brock Rozen <brozen@webdreams.com> writes:
>
>BR> Can we include this in the beginning of the majordomo.cf file? Set it
>BR> to 10, for default, and then let people configure on their own
>
>This should probably be sent to the list at large, so I'll CC
>majordomo-workers. It should definitely be commented out by default, but
>it's a good idea to show how it's done. Here's a patch, tested under perl4
>and perl5.
>
>--- sample.cf.orig Mon Nov 18 14:12:48 1996
>+++ sample.cf Thu Nov 21 11:49:13 1996
>@@ -72,6 +72,20 @@
> #
> # $config'default_subscribe_policy = "open+confirm";
>
>+# You can force Majordomo to delay any processing if the system load is too
>+# high by doing something like the following (the exact method is
>+# system-dependent, but this works in most cases):
>+#$max_loadavg = 10; # Choose the maximum allowed load
>+#$_ = `/usr/bin/uptime`; # Get system uptime
>+#s/,/ /g; # Remove commas
>+#@uptime = split(' '); # Split into parts
>+#$loadavg = $uptime[$#uptime - 0]; # use 0 for 15 minute average,
>+# # 1 for 5 minute average,
>+# # 2 for 1 minute average.
>+#if ($loadavg >= $max_loadavg) {
>+# exit 75; # E_TEMPFAIL
>+#}
>+
> #
> # Configure X400 parsing here. This is functional, but not well tested
> # and rather a hack.
>
>
>Also, the X400 comment below doesn't look so good. Is it still "rather a
>hack"?
>
> - J<
Right idea, but not an ideal implementation. For starters, I'd change the
"split" line to
@uptime = split(/\s+/);
in order to make it less sensitive to the exact spacing of the numbers. In
fact, by substituting " " for "," before you do the split, you've
guaranteed that your comment about "use 1 for 5 minute average..." is
incorrect. Before the split, $_ will be something like "... 1.00 1.05
1.10"; after the split, @uptime will be something like ("...", "1.00", "",
"1.05", "", "1.10"). The extra spaces coupled with the restrictive split
pattern mean that the 5 and 1 minute averages are at array indices -3 and
-5, not -2 and -3.
I'd also recommend against using $_ in the config file; who knows if the
code processing the config file has made assumptions about what's in $_?
So, in summary, I'd change the relevant lines above to:
$uptime = `/usr/bin/uptime`;
$uptime =~ s/,/ /g;
@uptime = split(/\s+/, $uptime);
-Brent
----------------------+----------------------------+------------------------
Brent Chapman | Great Circle Associates | 1057 West Dana Street
Brent@GreatCircle.COM | http://www.greatcircle.com | Mountain View, CA 94041
----------------------+----------------------------+------------------------
Internet Tutorials from the Experts!
Follow-Ups:
References:
|
|