[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
The cron problem and a solution
Cron is the traditional Unix way for periodically performing
maintenance and cleaning tasks. Not doing them means for instance
than logs grow forever and than the whatis and locate databases are
To avoid doing those tasks when the computer is busy they are started
between 0 an 4am. Home user computers are powered off at such hours.
In fact because the user pays the power bills home user computers are
rarely left powered on when nobody is using them so any scheme based
on cron will not work.
The best we can do is to perform maintenance tasks when the load is low.
There is a software for performing maintenance tasks in home user
machines. It is called anacron. I have found than it lacks some
essential features like trying to not start maintence tasks when the
load is high.
The solution I propose is to use self-resubmitting batch jobs. Batch
will not start a job when the load is high and in addition it will not
start it until the term is expired. A problem is what happens if a
computer crashes at the wrong momenyt so the job cannot resubmit
itself. The solution is to check at boot time than all maintence jobs
are queued and resubmit if necessary. However the Unix "batch"
program is very primitive: to begin with it does not support the
jobname concept. The only solution I see for knowing if a job is
present in the queue is to grep for a magic comment in the files
present in the batch queue. Of course we should have to check
ownership to avoid security problems.
Because the traditional scheme is better for a continuously powered on
machine the user should be asked at install time if the computer will
be supposed to run 24h a day.
Jean Francois Martinez
==================== The Linux. Use the Linux, Luke! =======================