Subject: Another approach for periodic.d
To: None <tech-userlevel@netbsd.org>
From: Julio M. Merino Vidal <jmmv@menta.net>
List: tech-userlevel
Date: 04/25/2004 23:44:39
Hi again,

I installed a Debian box today, and checked how they handle the stuff to be run
periodically.  It is based on three directories (cron.{daily,weekly,monthly}),
where all the files placed in them are executed unconditionally when it's time
to do so.

To run the scripts in those directories, they have a 'run-parts' generic script;
this is what I liked (not the three-directory split).

So I'm thinking about a similar script that can execute some scripts in a
given directory, based on priorities and "timings".  (Well, I already wrote it;
it's very very simple).

Consider the following /etc/defaults/periodic.conf:

task1=daily
task1_step=1000
task2=daily
task2_step=2000
task3=daily
task3_step=3000
task4=weekly
task4_step=1000
...

And so on.  /etc/periodic.conf simply overrides taskN style variables to
change the periodicity of when they are executed, and/or changes taskN_step
variables to modify the order in which tasks are executed.

Then, you'd do this from cron:

run-parts -c /etc/periodic.conf -s daily /etc/periodic.d

I think the advantages of this are:

- A single configuration file to tune when tasks are executed and the order
  between them.

- No need to mess with file names to change the order of tasks.  And the
  order is very concrete, not like rcorder (which most of you disliked).

- A generic script to run the scripts that could be used in other places.

Comments?

Cheers

-- 
Julio M. Merino Vidal <jmmv@menta.net>
The NetBSD Project - http://www.NetBSD.org/