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

Re: Niced cron jobs



Craig Sanders <cas@taz.net.au> wrote:
>at the most there should be an /etc/cron.nice.conf (or an extra field
>in /etc/default/rcS) file which allows people to set once and for all
>what nice level their cron jobs run at - this could be read in by
>/etc/init.d/cron when cron starts up, or alternatively by run-parts.
>
>if you're going to advocate doing weird and unusual things then you
>should at least advocate doing it in a typically sensible debian fashion
>- don't force it on everyone, make it an easily tweaked configuration
>option.

A /etc/cron.nice.conf read by run-parts sounds like an excellent
compromise.  

I suggest that run-parts should accept a new option:

     --nice NUM
              If NUM is a number, then the scripts are run under "nice
              -NUM".  Otherwise, if NUM is a file, then that file
              should contain the number.  Comment lines starting with
              # should be ignored.  That is, the scripts would be run
              under "nice `grep -v ^# NUM` ".

An entry in /etc/crontab would look like this:

  25 20   * * *   root  run-parts --report --nice /etc/cron.nice.conf  \
              /etc/cron.daily

And the standard /etc/cron.nice.conf would contain something like
this:

  # "nice" value for running periodic jobs.  
  # 10  for lower than normal priority (so as not to annoy online users).
  # -10 for higher than normal priority (possibly useful for a heavily
  # loaded machine, to ensure the jobs finish before being restarted).
  # no entry at all for normal priority.
  10

			- Jim Van Zandt


Reply to: