sn,v0.3.8(8)
β¨ sn β The sn news system β¨
okay bestie, sit down, hydrate, because we're about to talk about the sn news system β that's sn, manual section 8, and she's giving tiny-but-mighty news server energy π
π NAME π
sn β the sn news system. that's it, that's the whole name. iconic.
πΈ DESCRIPTION πΈ
picture a news spool as a little black box π€ and sn is a whole squad of programs that handle everything you'd ever wanna do with that box:
- put articles in β that's
snstore - look at articles inside β that's
snntpdandsncat - yeet old articles out β that's
snexpireandsncancel - make a list of what's in there β
snscanandsnprimedb - show off that list β
sndumpdb
and if the box is empty? no worries, she'll go find the articles for you β that's snget π¦
the sn system is built for small sites, like spooling a few dozen to a few hundred newsgroups. it is not meant for sites carrying a full news feed, so don't come for her with that π
sn is suitable as a replacement for leafnode (ftp.troll.no, by Arnt Gulbrandsen). she doesn't have leafnode's intelligence when it comes to retrieving upstream articles, but she's less demanding on the filesystem and takes up less disk space. lowkey a bargain π
sn supports local news groups. yes ma'am.
sn tries to create aliases for crossposts instead of storing the article multiple times. no duplicate storage, we love to see it β¨
sn can compress articles to save disk space. compressing and uncompressing take place transparently β you literally won't even notice, she's just like that π
sn doesn't use configuration files. instead, you write small shell scripts to customize sn's behaviour. DIY queen π
π REQUIREMENTS π
sn has been tested only against Linux ver. 2.0. she 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. that's not a vibe, that's just the facts π«Ά
I (harold-sn@nb.com.sg) am interested in bug reports, comments, and suggestions. bestie, come talk to me, I want the feedback fr fr π
π¦ NEWS SPOOL STRUCTURE π¦
the news spool is /var/spool/sn, which all sn programs need in order to run. no spool, no service, periodt.
it contains the group directories in news.group.name format rather than the traditional news/group/name. we keep it flat and cute π
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. fewer files, fewer inodes, happier filesystem πΈ
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. organized AND efficient, she's a whole main character π
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. so like, the control file lives exactly where it does the controlling, iykyk.
in particular, if the group directory does not have a subdirectory .outgoing in it, it is considered a local news group.
π BUGS π
okay now the part where we hold hands and read the scary stuff together π
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. sneaky little ghost article π»
sn doesn't sync the ID database after each write, so it could get corrupted. not great, not terrible, but real.
if you suspect it is corrupted, delete the files/var/spool/sn/.table,/var/spool/sn/.chain, and/var/spool/sn/.newsgroup, making suresnntpdandsngetaren't running or scheduled to do so. then run the magic incantation below and she'll recreate the ID database for you β¨
cd /var/spool/sn; snscan -n * |snprimedb
this will recreate the ID database. fixed, slayed, moving on π
π PROGRAMS π
the whole friend group, one by one:
sncatβ prints out the specified articles. this is useful if you want to transport the spool to another system. moving day, but make it news πsndumpdbβ dumps the ID database. it is not normally used.snexpireβ expires articles in the spool.snfetchβ is the back end of the article fetcher. you can use suck (a separate package) instead.sngetβ is the front end of the article fetcher.snmailβ converts a normal email message into a news article. it can be used to turn a mailing list into a local newsgroup. glow up transformation πsnnewgroupβ is a script to create newsgroup directories.sndelgroupβ is a script to delete newsgroup directories and flush the ID database of references to those articles. cleanup era π§Ήsnntpdβ is the news server (annnrpd).snprimedbβ 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.snscanβ 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 tosnprimedb. this program is not used in normal operation.snsendβ takes articles on standard input and distributes them according to the type of newsgroup.snstoreβ likesnsend, but considers all newsgroups as local, so stores all articles locally only. homebody behavior, respect it πsncancelβ cancels articles, so they are no longer available locally.
π CONVENTIONS π
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. so like, don't assume 0 vs not 0, read the number, bestie π
Options
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. stack those -ds, she can take it π
Environment
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. polite and considerate, we stan π«Ά
π SEE ALSO π
sncat(8), sndumpdb(8), snexpire(8), snfetch(8), snget(8), snmail(8), snnewgroup(8), sndelgroup(8), snntpd(8), snprimedb(8), snscan(8), snstore(8), snsend(8)
N.B. this whole thing was written by Harold Tay, and you're reading sn,v0.3.8(8) from the System Manager's Manual. thanks for coming to my ted talk, go spool some articles bestie, ily ππβ¨
π¦ where this page comes from
- debian bookworm: sn 0.3.8-12
- ubuntu jammy: sn 0.3.8-12
- ubuntu noble: sn 0.3.8-12
- ubuntu resolute: sn 0.3.8-12
- ubuntu stonking: sn 0.3.8-12
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms