Mailfromd |
|
General-Purpose Mail Filter |
Sergey Poznyakoff |
Mailfromd Manual (split by node): | ? |
There are two principal operations of database management:
expiration and compaction. Expiration consists in removing
expired entries from the database. In fact, it is rarely needed,
since the expired entries are removed in the process of normal
mailfromd
work. Nevertheless, a special option is provided
in case an explicit expiration is needed (for example, before dumping
the database to another format, to avoid transferring useless
information).
The command line option ‘--expire’ instructs
mailfromd
to delete expired entries from the specified database. As
usual, the database is specified using ‘--format’ option. If
it is not given explicitly, ‘cache’ is assumed.
While removing expired entries the space they occupied is marked as free, so it can be used by subsequent inserts. The database does not shrink after expiration is finished. To actually return the unused space to the file system you should compact your database.
This is done by running mailfromd --compact (and, optionally,
specifying the database to operate upon with ‘--format’
option). Notice, that compacting a database needs roughly as
much disk space on the partition where the database resides as is
currently used by the database. Database compaction runs in three phases.
First, the database is scanned and all non-expired records are stored
in the memory. Secondly, a temporary database is created in the state
directory and all the cached entries are flushed into it. This
database is named after the PID of the running
mailfromd
process. Finally, the temporary database is
renamed to the source database.
Both ‘--compact’ and ‘--expire’ can be applied to all databases by combining them with ‘--all’. It is useful, for example, in ‘crontab’ files. For example, I have the following monthly job in my ‘crontab’:
0 1 1 * * /usr/local/sbin/mailfromd --compact --all |
Mailfromd Manual (split by node): | ? |
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.