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

Re: The cron problem and a solution



George Bonser wrote:
> 
> That is going to happen regardless.  Imagine that the system looks at the load
> and sees that it is low and kicks off a process to rebuild the man database.
> Just then, the user attempts to do something but the system is performace is
> poor because of the process that started just BEFORE the user tried to do
> something.

I agree.  Nice should be used on housekeeping even if the system seems
to be idle.

> But what alternative do we have?  Simply wait for the system load to be low and
> HOPE it stays that way? Not likely given the nature of the use of the system.
> If it is likely to remain unused for any period of time, the user will likely
> switch it off. Some combination of both methods is probably in order.
> 
> 1) Roll logs on start up or shut down.  This does not take very long.
> 2) Rebuild man database in the background (niced) after package installation or
>    deletion.
> 3) Other housekeeping activities submitted as batches to at or cron (at being
>    better because you can specify the execution time as a delta from now).

A good plan.  I think the best way to do it is to check idle time on the
CPU *then* grep last to see how long the user has been idle on his
terminal(s).  The odds are in our favor if the idle times are similar. 
This most likely means the user has walked off and left the machine.

Checking if the screen is blanked or a screen saver is running is
another option.

If the CPU has only been idle for a minute or so and the user has been
idle for 20 minutes then it's possible he left while a task completes. 
In this case we can have housekeeping wait until the CPU idle time is up
to 5 minutes to insure the user isn't monitoring the completion of the
task to start back in right when housekeeping starts.

This can all be done with cron and anacron.

> 
> > I don't like it.  People will not want to wait 10 minutes until the
> > computer shuts down properly.

Good point.  If a severe T-storm is moving in you don't want your system
running these things when you're trying to shutdown before the power
lines are hit.


-- 
Out here,

Rick Jones
rickya@siservices.net