---
name: "newsmaint"
section: "8cn"
platform: "linux"
package: "cnews"
version: "cr.g7-40.4"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/newsmaint"
---

# newsmaint(8cn)

extract history line for news article(s) newsdaily - maintain news log files and report problems newswatch - keep an eye on news system for difficulties newsboot - clean up news debris on reboot locknews - lock news system addgroup, delgroup - add and delete newsgroups, locally only adddirs - make any missing directories for active newsgroups act.to.times - create active.times file for news readers histfrom, newsfrom - list news arriving over specific time range addmissing - add missing news articles to history file

## NAME

newshist - extract history line for news article(s)\
 newsdaily - maintain news log files and report problems\
 newswatch - keep an eye on news system for difficulties\
 newsboot - clean up news debris on reboot\
 locknews - lock news system\
 addgroup, delgroup - add and delete newsgroups, locally only\
 adddirs - make any missing directories for active newsgroups\
 act.to.times - create active.times file for news readers\
 histfrom, newsfrom - list news arriving over specific time range\
 addmissing - add missing news articles to history file

## SYNOPSIS

**/usr/lib/news/maint/newshist** msgid ...\
 **/usr/lib/news/maint/newsdaily**\
 **/usr/lib/news/maint/newswatch** \[ spaceunit spacemin \[ inbatchmax \] \]\
 **/usr/lib/news/maint/newsboot**\
 **/usr/lib/news/maint/locknews** \[ **-v** \]\
 **/usr/lib/news/maint/addgroup** group {**y**\|**n**\|**m**\|**x**\|**=***realgroup*}\
 **/usr/lib/news/maint/delgroup** group\
 **/usr/lib/news/maint/adddirs**\
 **/usr/lib/news/maint/act.to.times** activefile\
 **/usr/lib/news/maint/histfrom** startdate \[ enddate \]\
 **/usr/lib/news/maint/newsfrom** startdate \[ enddate \]\
 **/usr/lib/news/maint/addmissing** \[ **-d** \] \[ **-v** \]

## DESCRIPTION

These programs are utilities useful in maintaining a C News system and diagnosing problems in it.

*Newshist* prints the history line for each article identified by a *msgid*.

*Newsdaily* performs minor maintenance chores that typically should be done once a day for the news system: saving copies of log files and truncating them, reporting logged errors, checking for anomalies suggesting something is wrong, and cleaning out leftover files. *Newsdaily* saves one generation of old *log* files and three generations of old *errlog* and *batchlog* files. It reports problems via *report*(8CN).

*Newswatch* looks for indications of news problems on a shorter time scale than those reported by *newsdaily*, notably strangely-persistent lock files that may indicate a news-system failure. If *spaceunit* and *spacemin* are specified, *newswatch* checks the *incoming*, *articles*, *control*, and *outbound* areas to confirm that there is room for at least *spacemin* files, each of length *spaceunit* bytes, in each, and reports it if not. If *inbatchmax* is specified, *newswatch* inspects the incoming-news spooling area and reports if more than *inbatchmax* files are awaiting processing. *Newswatch* delivers its report, if any, via *report*(8CN). It typically should be run fairly frequently, perhaps once or twice an hour.

*Newsboot* should be run from */etc/rc* or the system's equivalent on reboot. It cleans up files that the news system might have left lying about if the system crashed while news was being processed, notably old lock files.

*Locknews* locks the news system (retrying until it succeeds), starts up a shell (**$SHELL** if set, otherwise the system's standard shell) with the **PS1** and **prompt** environment variables prepended with executable reminders, and waits around to unlock the news system when that shell terminates. This simplifies manual maintenance. **-v** produces messages on standard error upon successful locking and unlocking; this is only needed by users of shells that import neither **PS1** nor **prompt** to set their prompts, notably C shells.

*Addgroup* and *delgroup* respectively add a newsgroup (with a specified flags field for the *active* file, normally \`y' \[see [*newsdb*(5)](/newsdb/5.md)\]) and delete a newsgroup manually, with proper locking. The effect is purely local; no control message (to propagate the change to other machines) is sent.

*Adddirs* sweeps through the *active* file checking that directories exist for all newsgroups. (*Relaynews* will create directories as needed, but some user-interface software gets upset if a newsgroup exists but its directory does not.) This is mostly useful when adding groups in bulk, based on another site's *active* file.

*Act.to.times* emits (on standard output) a new *active.times* file (see [*newsdb*(5)](/newsdb/5.md)) based on the contents of *activefile*, which should normally be */var/lib/news/active*.

*Histfrom* emits (on standard output) all history lines for unexpired articles arriving between *startdate* and *enddate*. The dates must be acceptable to *getabsdate* (see *newsaux*(8CN)). The default *enddate* is now.

*Newsfrom* runs *histfrom* and processes its output to produce a list of absolute pathnames of articles arriving between *startdate* and *enddate* (default now).

*Addmissing* scans the *history* file and the news-article tree to find articles that are not in the history file, and adds them to the file and the *dbz* database. If the **-d** option is given, *addmissing* rebuilds the *dbz* database from scratch after adding the missing articles to the history file; this is a convenience for use in disaster-recovery situations where manual repairs to the history file have rendered the file incomplete and the *dbz* database invalid. If the **-v** option is given, *addmissing* reports how many missing articles were found (and shows the resulting *history* lines, if there are not too many) on standard output.

## FILES

```
/var/lib/news/history	history file
/var/lib/news/history.pag	dbz database for history file
/var/lib/news/history.dir	dbz database for history file
/var/lib/news/log	current news log
/var/lib/news/log.o	previous news log
/var/lib/news/errlog	current news-error log
/var/lib/news/errlog.o*	old news-error logs
/var/lib/news/batchlog	current news-batcher log
/var/lib/news/batchlog.o*	old news-batcher logs
/var/spool/news/in.coming	input-spooling area
/var/spool/news/out.going	output-batching area
/var/lib/news/watchtime	last time newswatch was run
/var/lib/news/active	list of current newsgroups
/var/lib/news/active.old	backup copy created by addgroup and delgroup
/bin/sh	standard Unix shell
/bin/rc	standard Plan 9 shell
```

## SEE ALSO

[df(1)](/df/1.md), [uucp(1)](/uucp/1.md), [ls(1)](/ls/1.md), [ctime(3)](/ctime/3.md), getabsdate(3), [grep(1)](/grep/1.md), [newsdb(5)](/newsdb/5.md), cnewsdo(8CN), expire(8CN), newsbatch(8CN), report(8CN), rnews(8CN), newsaux(8CN)

## DIAGNOSTICS

*Locknews* complains and exits if it is unable to lock the news system due to inadequate permissions.

*Addmissing* complains and exits if it is unable to lock the news system, if *expire* appears to be running, or if there is not enough space for a temporary copy of the *history* file and database. It also notes the presence of articles which did not have intelligible headers (which are placed into history with an entry specifying immediate expiry). Complaints from it about articles being \`\`already present'' indicate a corrupt history file rather than merely missing articles; a complete rebuild is indicated if the offending entries cannot be identified and removed manually.

## HISTORY

Written as part of the C News project by Henry Spencer and Geoff Collyer.

## BUGS

*Delgroup* does not remove files or directories from /var/spool/news, although it prints a reminder to do so.

*Addmissing* balks at dealing with articles which are already in history but with an incomplete list of pathnames. This is very hard to fix.

*Addmissing* will falsely think articles are missing—leading to the problem above—if a newsgroup name has a component longer than 14 characters on a system which limits directory entries to 14. This too is fairly hard to fix.

Various nuisances can result if the maintenance utilities are run as *root* rather than as the owner of the news database. It's difficult to defend against this.
