laptops and cron maintenance

Michael A. Peters mpeters at mac.com
Tue Apr 19 10:17:53 UTC 2005


In fc4t2 the updatedb cron job was turned off by default.
In part for laptop users.

Suppose instead of turning certain cron jobs off, a configuration  
allowed one to specify times when they are not allowed to run.

IE configure updatedb so that it is not allowed to run between 0700 and  
1800 (user configurable)

Also, it shouldn't be too difficult for the cron script to check and  
see if the laptop is on battery, and just not run certain scripts (like  
updatedb) if the laptop is on battery.

But defaulting it to run, but not run during normal business hours  
would OOB solve the problem for most people without it being disabled  
OOB and would be relatively easy to implement, and probably not too  
difficult to slap a system-config-gui on

(a file somewhere -

# maintenance cron configuration file
#name of script|boolean for check time|no run start|no run end|boolean  
for battery abort
slocate.cron|true|0700|1800|true
logrotate|false|||false

slocate.cron checks for time, doesn't run between 0700 and 1800,  
doesn't run if on battery.
logrotate doesn't check for time (and thus doesn't care about values in  
the next two fields) and also doesn't care about battery.

A maintenance cron not having an entry in the config file would have  
same effect as the logrotate entry (just does its thing)

I suppose it would require a patch to anacron to have it check the  
config file, so that the scripts don't have to check for themselves -  
which is probably the right way to do it, cron itself should not care  
if the system is up when cron is told to do its thing, so it shouldn't  
be up to the script to determine if it should run. IMHO.



-- 
Michael A. Peters
http://mpeters.us/






More information about the test mailing list