Running a python program during idle time only

Terry Hancock hancock at anansispaceworks.com
Mon May 23 00:24:55 EDT 2005


On Friday 20 May 2005 08:06 pm, los wrote:
> I'm wondering if anyone knows of a way that I could make so that the
> program will run at full speed only runs after the computer has been
> idle for a while.  I've looked at the "nice" command but that's not
> exactly what I want.

You need to define what "idle" means:  Screensavers do this in more
than one way, but typically, "idle" means "no user input has occured",
in which case you are looking for the time since the last input signal
from keyboard or mouse (not sure how to do this off the top of my
head, but that's the "screensaver" approach).

This is much less meaningful on a multiuser / multiple terminal
machine, of course.  And it's really nonsense on a machine that is
also acting as a server. That's why "nice" seems like a more logical
solution for these types of machines.

Someone's already mentioned checking the load average, which 
sounds like a good idea for your application.


--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list