< process-control | Russ Allbery > Software > control-archive |
(Manually update the newsgroup database)
update-control newgroup group mode description
update-control rmgroup group
update-control checkgroups prefix < checkgroups
update-control bulkload < checkgroups
This program supplements process-control, which handles automatic processing of control messages, by allowing manual changes to be made to the same database, locking properly and making the same sorts of log entries.
newgroup creates a new group with the specified mode (which should be
either y
or m
) and description (which for moderated groups must end
with (Moderated)
). Note that the description generally contains
whitespace and therefore must be quoted for the shell. If the newsgroup
already exists in the database, this command can still be used to change
the mode or description of the group.
rmgroup removes the specified group from the database.
checkgroups applies a checkgroups for the given prefix, which should be
the common prefix shared by all of the groups in the checkgroups message.
A period will be appended to prefix and then only groups in the
checkgroups that start with that prefix will be processed.
update-control will expect on standard input a file in checkgroups
format (one line per group in the format group name, whitespace, group
description, where the description ends with (Moderated)
if the group
is moderated). Any discrepancies with the newsgroup database will be
corrected.
bulkload does the same thing as checkgroups except that it doesn't take a prefix, processes all groups in its input, refuses to remove groups or change the mode or description of existing groups, and doesn't log. It's used for bootstrapping a database from a newsgroups file.
download uses the LIST command to get a list of newsgroups in a particular hierarchy from a remote server and prints to standard output a checkgroups file for that hierarchy. It doesn't attempt to retrieve group descriptions.
The log messages will also be printed to standard output if any action is taken.
Please note that to work properly, update-control has to have write permissions to the database and log files, the same as process-control.
Add the new newsgroup example.test:
update-control newgroup example.test y 'Testing examples.'
Add the new moderated newsgroup example.moderated:
update-control newgroup example.moderated m \ 'Moderated examples. (Moderated)'
Remove example.moderated:
update-control rmgroup example.moderated
Bootstrap the database from a previous newsgroups file:
update-control bulkload < newsgroups
Apply a checkgroups for the example.* hierarchy:
% cat | update-control checkgroups example example.moderated Moderated examples. (Moderated) example.test Testing examples. <Ctrl-D>
(The % indicates a Unix shell prompt and is not part of the command. The Ctrl-D indicates that keypress. This is an example of someone typing the checkgroups in to the program; normally, one would instead save just the body of a checkgroups message in a file and then pipe it into update-control as in the previous example.)
The database of active groups, updated as described above. It is locked
against simultaneous access by using fcntl locking on a file by the same
name but with .lock
appended.
Where actions are logged. %Y is replaced by the current four-digit year and %m by the current two digit month.
Russ Allbery <eagle@eyrie.org>
process-control(1)
This script is part of the control-archive package. The control-archive web page at <https://www.eyrie.org/~eagle/software/control-archive/> will have the current version of the package.
< process-control | Russ Allbery > Software > control-archive |