From owner-freebsd-hackers Thu Jan 1 08:18:43 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.7/8.8.7) id IAA18572 for hackers-outgoing; Thu, 1 Jan 1998 08:18:43 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from post.mail.demon.net (post-20.mail.demon.net [194.217.242.27]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id IAA18559 for ; Thu, 1 Jan 1998 08:18:30 -0800 (PST) (envelope-from dmlb@ragnet.demon.co.uk) Received: from ragnet.demon.co.uk ([158.152.46.40]) by post.mail.demon.net id aa2010767; 1 Jan 98 16:13 GMT Received: from dmlb by ragnet.demon.co.uk with local (Exim 1.73 #1) id 0xnn3m-0003M9-00; Thu, 1 Jan 1998 16:01:26 +0000 Message-ID: X-Mailer: XFMail 1.1 [p0] on FreeBSD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <87pvmdaal0.fsf@pippin.jblhome.ping.dk> Date: Thu, 01 Jan 1998 15:45:50 -0000 (GMT) From: Duncan Barclay To: Jacob Bohn Lorensen Subject: Re: Revamping /etc/daily, weekly, monthly Cc: hackers@FreeBSD.ORG Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk >Duncan Barclay 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. ________________________________________________________________________