thdexpire

(dynamic expire daemon for timehash and timecaf storage)

SYNOPSIS

thdexpire [ -t minutes ] [ -f kilobytes ] [ -i inodes ] [ -m mindays ] [ -x minseconds ] [ -N ] [ -v level ]

thdexpire -r

DESCRIPTION

This is a daemon, to be started along with innd, which periodically looks if news spool space is getting tight, and frees space by removing articles until enough is free. It is an adjunct (not a replacement) to INNs expire program.

Setting Up

  1. Configure your storage classes carefully. Let the default go in class 100 and choose the storage classes as relative (percent) retention times. E.g. if you want to give alt.binaries.* a fifth of the default time, put them in class 20. Storage classes above 200 are ignored by this program. 0 expires immediately. An example is given in EXAMPLES.

  2. Set up your expire.ctl in a way that it puts only a maximum cap on retention times. Run expire from news.daily as usual. However, it should only expire articles which have an Expires line or are in classes above 200. See EXAMPLES.

  3. Ensure to start this daemon along with innd.

  4. To get information and statistics, run thdexpire -r (in parallel to a running daemon). This will show you the current actual retention times.

How It Works

thdexpire works directly on the spool. It assumes the layout described in the timehash and timecaf sections of storage.conf(5) as of INN-2.x-CURRENT (Dec. 5, 1998). For every storage class associated with timehash/timecaf, thdexpire keeps a work time which is the modification time of the oldest article/CAF file in this class. This time is chosen so that the difference of the work time of class N to now (i.e. the retention time for class N) will be N/100 of the retention time of class 100. The work time of all classes is continuously adjusted as time goes by. Articles and CAF files which are older than the work time are deleted.

OPTIONS

-t minutes

Check for free space every minutes minutes (default 30).

-f kilobytes

Leave kilobytes kilobytes of free disk space on each spool filesystem (default 50000).

-i inodes

Leave inodes inodes free on each spool filesystem (default 5000).

-m mindays

Set the minimum normal holding time for class 100 to mindays days (default 7).

-x minseconds

Set the absolute minimum holding time for any article to minseconds seconds (default 86400, i.e. 1 day).

-N

Do not delete any articles, just print what would be done.

-v level

Set the verbosity level. Values from 1 to 3 are meaningful, where higher levels are mostly for debugging.

-r

Do not run as a daemon, instead print a report from the database (see FILES) on the available storage classes, current expire times and other stuff.

EXAMPLES

Here is an example storage.conf file:

 # Large postings in binary groups are expired fast:
 # 20% retention time
 method timehash {
   newsgroups: *.binaries.*,*.binaer.*,*.dateien.*,alt.mag.*
   size: 30000
   class: 20
 }

 # Local groups and *.answers groups don't expire at all with
 # thdexpire. These are handled by Expires lines and a cutoff
 # in expire.ctl.
 method timehash {
   newsgroups: *.answers,news.announce.*,local.*
   class: 201
 }

 # Expires lines are honored if they dont exceed 90 days.
 # Exempt those postings from thdexpire handling.
 method timehash {
   newsgroups: *
   expires: 1d,90d
   class: 202
 }

 # Default: should be class 100 because thdexpire bases its
 # calculations thereupon.
 method timecaf {
   newsgroups: *
   class: 100
 }

And here is an expire.ctl which fits:

 # Our local groups are held 6 months
 local.*:A:7:180:180
 # Everything else is handled by thdexpire, or Expires lines
 *:A:7:never:never

Note that thdexpire does not actually use these files, they just configure other parts of the news system in an appropriate way.

FILES

pathdb/thdexpstat.{dir,pag}

Holds state information like classes, expire times, oldest articles. When this file is missing, it will be rebuilt the next time the daemon is started, which basically means scanning the spool directories to find the oldest articles. With the -r option, the contents of this file are printed.

pathrun/thdexpire.pid

Contains the PID of the running daemon.

SIGNALS

SIGINT or SIGTERM can be sent to the daemon at any time, causing it to gracefully exit immediately.

SEE ALSO

expire(8), news.daily(8), storage.conf(5)

NOTES

This version needs the inndf program supplied with newer releases of INN.

The filenames for timecaf were wrong in older versions of the INN documentation. This program uses the true filenames, as found by reading the INN source.

DIAGNOSTICS

Any error messages are printed on standard error. Normal progress messages, as specified by the -v option, are printed on standard output.

BUGS

Storage classes which are in storage.conf but not on disk (i.e. which have never been filed into) when the daemon starts are ignored.

The code is ugly and uses too many global variables. Should probably rewrite it in C.

RESTRICTIONS

Directories which are left empty are not removed.

The overview database is not affected by thdexpire, it has to be cleaned up by the daily regular news.daily run. This may need a patch to expire.

AUTHOR

Olaf Titz <olaf@bigred.inka.de>. Use and distribution of this work is permitted under the same terms as the INN package.

HISTORY

Inspired by the old dexpire program for the traditional spool.

June 1998: wrote the first version for timehash.

November 1998: added code for timecaf, works on multiple spool filesystems, PODed documentation.

July 1999: bugfixes.

Last modified and spun 2022-12-12