Newsgroups: news.software.b
Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!geac!gjetor!adeboer
From: adeboer@gjetor.geac.COM (Anthony DeBoer)
Subject: Re: expire
Message-ID: <1991Jun21.143814.15606@gjetor.geac.COM>
Organization: Geac Canada Ltd.
References: <4313@anasaz.UUCP>
Date: 21 Jun 91 14:38:14 GMT

In article <4313@anasaz.UUCP> rusty@anasaz.UUCP (Rusty Carruth) writes:
> [ proposed spec for freespace-based expire program ]
>
>(Note that my intention is to run the above algorithm from top to bottom,
>THEN actually remove the files, thus allowing me to traverse the tree only
>once)

Actually, C news expire never traverses the /usr/spool/news tree.  It reads
through the history file, decides what to do with each line, and reaches into
the spool directories only to unlink() (or archive) articles.  It will
normally also (ie. unless you use the -r option) rewrite the history file to
reflect the deletions.

If I was sitting down to write your program, I'd use expire to do the dirty
work (it's already written, it's fast, and it works), feeding more-or-less
severe explist files to it and then checking freespace to see if the next pass
should be taken or not.  You could either write a series of explist files
manually, calling them explist.1, explist.2, and so on, each reflecting one
pass of your algorithm, or write a program (which could be an awk script) to
generate the n-th version from a master file containing additional parameters.

A shell script based on the existing "doexpire" script could handle taking the
appropriate number of passes everytime cron invokes it (and you could have it
start up periodically during the day and check if you're really tight on space
and do a pass or so, and feed it a different parameter on the cron command
line at night to do a proper cleanup).  If you want to get fancy, have it save
the "severity level" it ran at the last time, and use this when you start off.
If there's a lot of freespace, back off a level or two, then start with an
expire pass at the appropriate level.

(BTW, if you want to do a run to delete only "junk" groups, you could feed
expire an explist that tells it that all groups except the ones listed stick
around for 999 days, for example.)

Just as a disclaimer, even though my gut feeling was originally that I needed
something like this on my system, it's turned out that a pretty-near-vanilla C
News is working quite happily here, so I've never sat down to actually
implement such a thing.  The only real problem I've had with news is that
newsrun, spacefor, and relaynews were conspiring to use up all my inodes,
which I've patched, and Henry tells me they're looking at doing a proper fix
in the next major release.
-- 
Anthony DeBoer  NAUI#Z8800                             adeboer@gjetor.geac.com
Geac Canada Ltd., Toronto                             uunet!geac!gjetor!adeboer
