> On Thu, Oct 03, 2002 at 10:10:34AM -0700, Jessee Parker wrote: > > At the top of the loop, I check the system uptime to get the load average > > so I can have the program sleep for 5 seconds to let things stabilize a > > bit. > > I suspect an easier way of doing this would be to nice yourself down really > low; see man nice. There may be a Perl module available on CPAN for doing > this, as well. >
I will definitely take a look at this. How do you determine what your current "nice" status is? > > > When this happens, the message "Sleeping" is printed out to a log file. > > However, I noticed that the program ended up sleeping without printing the > > message. > > It sounds to me like you might be having a buffering issue; while the > process did print before going to sleep, the output was never flushed to the > file. See http://perl.plover.com/FAQs/Buffering.html. > > > > The condition I set for load average was never reached so there was no > > reason for it to sleep. I ran a netstat -an and there were alot of tcp > > connections to port 25 in the TIME_WAIT mode. > > How did you verify the condition was never reached? If you determined it > independently of the program printing to its log file then I'd have to see > the code to be able to tell you what's going on. > What I did was had top running and watched the load average. The code I am using to check the load average is this: $highload = ".8"; while (($currload = &Load) > $highload) { print LOG "Sleeping\n"; sleep 5; } sub Load { # Test system load and wait if it's too high @uptime = split(/,/, `uptime`); $fraction = $uptime[3]; $load = (split /:/, $fraction)[1]; return $load; } The buffering information is great, but I will have to wait until the next run to see if that is indeed why "Sleeping" isn't being printed out. When I do local tests, I can print "Sleeping" to the screen with no problem. Even when I take out the LOG in the above, "Sleeping" does not get printed out with an actual run of data (an actual run being subscriber e-mail addresses versus e-mail accounts I have set up on various sites for testing). -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]