How to use watchdisk and to dynamically do News expiration based on how much disk space is available.

On each filesystem to be monitored, have a .watchtab file with three sections. The first section contains lines that will cause to be executed to revise expiration times in a filesystem-specific expire.ctl file. For example, in a filesystem called /news4 we might have a .watchtab file like this:

# This file is /news4/.watchtab # # First revise expiration time in qexp.news4 400 cd /news/inn/lib; subst qexp.news4 ALL=3 300 cd /news/inn/lib; subst qexp.news4 ALL=3.5 200 cd /news/inn/lib; subst qexp.news4 ALL=2 100 cd /news/inn/lib; subst qexp.news4 ALL=1 # Then expire 400 cd /news/inn/lib; /news/bin/qexp qexp.export.news4 # Then do last-resort actions if we still do not have sufficient space # e.g., page operator. 100 sendpage "`hostname` %DIR% has only %FREE% M free"

Run watchdisk periodically fron cron.

The file qexp.news4 is a customized expire.ctl file. Suppose we have comp.* and rec.* hierarchies on /news4. Then qexp.news4 might contain these lines:

# This file is /news/inn/lib/qexp.news4 # Quick expire for /news4. /remember/:7 # Default is expire nothing. *:A:never:never:never # Expire comp.* and rec.* #%SUB%comp.*:A:%ALL%:%ALL%:%ALL% comp.*:A:4:4:4 #%SUB%rec.*:A:%ALL%:%ALL%:%ALL% rec.*:A:4:4:4

When watchdisk runs, it checks each line in the .watchtab file, and invokes to update the expiration times represented by the macro %ALL% in the file qexp.news4. Then News expiration occurs and space is recovered. In the example above, if /news4 had slightly less than 200 megabytes left, a version of the qexp.news4 file would be generated in which comp.* and rec.* were expired retaining 2 days of News.

The program qexp that is invoked from the .watchtab file should be a small script that you will write. It will expect a single argument which will be the name of an expire.ctl file. It will invoke the actual News expiration program supplying it the name of the expire.ctl file along with any other needed arguments. The qexp script can be quite simple, e.g;

#! /bin/sh # This file is /news/bin/qexp # Invoke news.daily, supplying it the name of # a custome expire.ctl file. /news/inn/bin/news.daily delayrm expctl=$1 \ nologs nomail norenumber norotate nostat notdaily flags='-v1 -l'

To my software page

$Id: instructions.html,v 1.2 1997/08/13 12:03:39 dhesi Exp $
$Source: /files/home/ftp/pub/dhesi/www/software/RCS/instructions.html,v $