Subject: Re: Implementing periodic.d
To: Julio M. Merino Vidal <jmmv@menta.net>
From: Jim Bernard <jbernard@mines.edu>
List: tech-userlevel
Date: 04/05/2004 14:44:14
On Sun, Apr 04, 2004 at 12:18:52AM +0200, Julio M. Merino Vidal wrote:
> Hi again,
> 
> So here is a preliminar patch for this proposal; it still lacks documentation
> (manpages), but I won't write them until it gets reviewed properly.  As the
> changes are non-trivial (in the sense that they change what has been used for
> years with something new and different), I guess that this needs approval from
> core@, isn't it?
> 
> Note that existing /etc/{daily,monthly,weekly}.local scripts will keep
> working, to make the transition easier, although they are considered obsolete
> in the file lists.
> 
> Also, from Hubert's comments, I see that what I've done is quite similar to
> what FreeBSD has (though I haven't checked), with the exception that this uses
> rcorder to sort the scripts, instead of numbers in names.  (Note that rcorder
> is mostly useless now, because none of the scripts provided contain any of the
> special keywords recognized, but scripts can be easily ordered if needed; just
> as rc.d).
> 
> The patch itself is around 35kb, so I didn't attach it.  Please fetch from:
> 
> 	ftp://ftp.NetBSD.org/pub/NetBSD/misc/jmmv/periodic.diff
> 
> Could you comment?

  I'd like to describe some features of a scheme I've been using
happily for almost 7 years on a couple of systems, since they may be
of some interest to you or to others.  I split the daily, weekly,
monthly, and security scripts into separate task scripts that live
in /etc/maintenance/{daily,weekly,monthly,security}, and I added the
directories /etc/maintenance/{local,security.local} for local additions.
There's a utility script that contains some minor functions used in the
task scripts and two "user" functions, called "run" and "skip".  Then,
/etc/daily, e.g., does a little job-specific initialization, processes
the utility script, processes /etc/daily.conf if it's present, cleans
up, and exits.  If daily.conf is absent, daily has a default list of
tasks that it runs, and that list serves as a handy template for
initializing a conf file.  The conf file, which is just a shell
script, can contain commands like:

  run msgs
  #run expire_news
  run check_disks
  skip fsck
  run rdist

which do the obvious things.  There's no automatic running (or sorting)
of tasks---that's entirely up to the sysadmin.  The difference between
commenting out (or removing) a task from the list and changing "run"
to "skip" is that in the latter case, the mailed summary explicitly
tells me that I have configured the maintenance job to skip the task
(in cases where I want to be reminded of that).

  What I like about this is that it gives full and convenient control
to the sysadmin; all tasks for a given maintenance job are laid out
in a compact, easy-to-scan file, it's easy to make quick and/or
temporary changes to the task list, it's easy to see at a glance
exactly what is configured to run at any given time (like the current
conf files for the monolithic scripts), it's easy to switch tasks
from being done daily to being done weekly, e.g., and it's easy to
create and use local additions or modifications of the standard
scripts.  (The directory in which a task script is to be found can
be specified in the conf file, so that local changes are easy to
make.)  It is, of course, not compatible with the current monolithic
scripts.

  If you find any ideas you like here, feel free to use them.

--Jim