sn(8) The sn news system.


If you think of a news spool as a black box, then sn is a bunch of programs to put articles in the box (snstore), to view articles in it (snntpd, sncat), remove old articles (snexpire,sncancel), generate a list of what's in it (snscan, snprimedb), or display that list (sndumpdb). In addition it can go find the articles to put in the box (snget).

The sn system is designed for small sites, spooling a few dozen to a few hundred newsgroups. It is not meant for sites carrying a full news feed. sn is suitable as a replacement for leafnode (, by Arnt Gulbrandsen). It doesn't have leafnode's intelligence when it comes to retrieving upstream articles, but is less demanding on the filesystem and takes up less disk space.

sn supports local news groups.

sn tries to create aliases for crossposts instead of storing the article multiple times.

sn can compress articles to save disk space. Compressing and uncompressing take place transparently.

sn doesn't use configuration files. Instead, you write small shell scripts to customize sn's behaviour.


sn has been tested only against Linux ver. 2.0. It makes heavy use of mmap(2) in MAP_SHARED and MAP_WRITE mode, so it won't work on pre-1.3.45 or so. I ([email protected]) am interested in bug reports, comments, and suggestions.


The news spool is /var/spool/sn, which all sn programs need in order to run. It contains the group directories in format rather than the traditional news/group/name. Each such directory contains article files, named serially from 1, 2, etc. Each article file consists of up to 10 articles, which reduces the number of files and inodes required. These article files are mmap(2)ed before use, and they are cached to reduce search time. sn tries to keep the headers of these articles bunched together, to reduce the memory footprint.

In addition to the article files, each newsgroup directory also contains files which control the behaviour of the sn system. All control files have filenames beginning with a dot, and they all reside in the group directory in which they are to have effect. In particular, if the group directory does not have a subdirectory .outgoing in it, it is considered a local news group.


When retrieving articles, there is a window of time between when an article is first marked as wanted and when it is committed to the news spool. Within this window it is possible to have the same article committed by a separate process. This defeats the aliasing feature so you could end up with more than one copy of an identical article.

The ID database will only store one instance of an articles {ID,group,serial} tuple. After the second copy is committed to the spool, snstore will try to commit it in the ID database, and will fail. So it is possible that after the article has been expired, another copy will still remain, but be inaccessible if requested by its ID.

sn doesn't sync the ID database after each write, so it could get corrupted. If you suspect it is corrupted, delete the files /var/spool/sn/.table, /var/spool/sn/.chain, and /var/spool/sn/.newsgroup, making sure snntpd and snget aren't running or scheduled to do so. Then run
cd /var/spool/sn; snscan -n * |snprimedb
This will recreate the ID database.


prints out the specified articles. This is useful if you want to transport the spool to another system.

dumps the ID database. It is not normally used.

expires articles in the spool.

is the back end of the article fetcher. You can use suck (a separate package) instead.

is the front end of the article fetcher.

converts a normal email message into a news article. It can be used to turn a mailing list into a local newsgroup.

is a script to create newsgroup directories.

is a script to delete newsgroup directories and flush the ID database of references to those articles.

is the news server (an nnrpd).

feeds the ID database from formatted standard input. This database is what permits articles to be specified by their ID. This program is not used in normal operation.

scans the specified articles and outputs a line consisting of the article's ID, newsgroup, and serial number within the newsgroup. This output is suitable for feeding to snprimedb. This program is not used in normal operation.

takes articles on standard input and distributes them according to the type of newsgroup.

Like snsend, but considers all newsgroups as local, so stores all articles locally only.

cancels articles, so they are no longer available locally.


Exit codes
All sn programs exit 0 on success, 1 on invocation error; 2 on system error; 3 on format or protocol error. Other exit codes are possible.

sn programs take -d to enable verbose messages (may be repeated), and -V, which displays the version and exits. Where a network timeout is appropriate, this is specified with -t timeout, in seconds. -P indicates the pid should be included in any status output. Other options are possible.

sn programs will take the contents of the SNROOT environment variable as the news spool rather than /var/spool/sn. If a program will need to run another, it appends /usr/sbin to its PATH variable if /usr/sbin is not already present.