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 snntpd and sncat
  • yeet old articles out β€” that's snexpire and sncancel
  • make a list of what's in there β€” snscan and snprimedb
  • 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 sure snntpd and snget aren'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 (an nnrpd).
  • 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 to snprimedb. this program is not used in normal operation.
  • snsend β€” takes articles on standard input and distributes them according to the type of newsgroup.
  • snstore β€” like snsend, 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