Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Jan 1998 15:45:50 -0000 (GMT)
From:      Duncan Barclay <dmlb@ragnet.demon.co.uk>
To:        Jacob Bohn Lorensen <jacob@jblhome.ping.dk>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Revamping /etc/daily, weekly, monthly
Message-ID:  <XFMail.980101160126.dmlb@ragnet.demon.co.uk>
In-Reply-To: <87pvmdaal0.fsf@pippin.jblhome.ping.dk>

next in thread | previous in thread | raw e-mail | index | archive | help

>Duncan Barclay <dmlb@ragnet.demon.co.uk> writes:
>
>> For some while I have been unhappy with the way the daily/weekly/monthly
>> scripts work.
>
Interesting, it seems that my orginal proposal has forked into a
different realm...

On 31-Dec-97 Jacob Bohn Lorensen wrote:
>I have long been toying with the idea of modifying cron instead to
>support non-24/7 machines. What I propose is to add an additional
>field, ``catchup-on-startup'' or whatever, which, if set, would cause
>cron to execute programs it would have executed if it had been on, at
>startup. I.e.:
>
># do daily/weekly/monthly maintenance
>0    2    *    *    *   once   periodic daily 2>&1 | sendmail root
>30   3    *    *    6   once   periodic weekly 2>&1 | sendmail root
>30   5    1    *    *   once   periodic monthly 2>&1 | sendmail root
>
>Would behave no differently on 24/7 machines. However, if the machine
>is off for some time (be it hours, days, weeks, ...) when cron comes
>up again, it will look at a time-stamp file to find out when the last
>cron job was run. Then it will quickly time-travel to the current
>time, executing everything it would-have executed. There should
>possibly be a way to flag entries as
[snip]
>
>What do you think of this idea?

Seems good for addressing the problem of non 24/7 machines, although
I think that David Kelly's version is probably better...

> Rather than altering cron and the crontab format why not write some 
> external function(s) to perform the tasks with similar syntax to the 
> suggestion at the top. Lets start with a program we'll call "periodic" 
> and apply it like this to root's crontab:
> 
> 0    2    *    *    *    root    periodic /etc/daily 2>&1 | sendmail
> root
> 
> When run periodic invokes the rest of the command line. And logs the 
> fact somewhere, perhaps /var/run/periodic.
> 
[snip]

The cron/boot time arguments are not exactly what I was addressing,
though. I want to clean up the daily/weekly/monthly scripts themselves
and make them more configurable. To this end I have started work on
bev (named after my cleaner). bev itself is just a concatenation
of the daily/weekly/monthly scripts, slightly re-ordered into
sections with similar functionality. Each action has a guard configured
using this file:

#
# $Id: bev.conf,v 1.1 1997/12/31 13:14:25 dmlb Exp $
#
# Configuration for bev, the system cleaner. This file
# is read into a shell script. 
#
# Each pair of variables determines when an action is run. The
# first variable can take any value, the action is executed
# if the bev is invoked with that value as its first argument.
# The second variable (with the _boot suffix) can be used to invoke
# an action at boot time.
#
# Eg.
# 
# clean_var.preserve=           daily
# clean_var.preserve_boot=      yes
# 
# invokes an action to clean up /var/preserve when bev is run as
# /etc/bev daily. Also the clean up is run when the machine is booted.
# 
# Typical values for when an action is to be run are:
#   daily weekly monthly boot none local
# The first three are used by cron(1) invoked runs of bev. "boot" is
# used to invoke bev from /etc/rc and "none" is used if bev is invoked
# with no arguments. The _boot variables should be set to one of
#   yes no
#
clean_var.preserve=             daily
clean_var.preserve_boot=        yes
clean_var.rhwo=                 daily
clean_var.rwho_boot=            yes

and the root crontab would now be

# do daily/weekly/monthly maintenance
0    2    *    *    *   bev daily 2>&1 | sendmail root
30   3    *    *    6   bev weekly 2>&1 | sendmail root
30   5    1    *    *   bev monthly 2>&1 | sendmail root

and /etc/rc would have
  /etc/bev boot
somewhere.

I think that the catchup/periodic bits for cron are orthogonal to
bev, so I will not add this functionality to bev itself.

Duncan

PS. I read hackers via the digest but I havent seen one since
28/12 so forgive me if I am a bit late in seeing all of this.

---
_______________________________________________________________________
Duncan Barclay          | God smiles upon the little children,
dmlb@ragnet.demon.co.uk | the alcoholics, and the permanently stoned.
________________________________________________________________________



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.980101160126.dmlb>