3 innduct \- quickly and reliably stream Usenet articles to remote site
11 implements NNTP peer-to-peer news transmission including the streaming
12 extensions, for sending news articles to a remote site. It is
13 intended as a replacement for
20 You need to run one instance of innduct for each peer site. innduct
21 manages its interaction with innd, including flushing the feed as
22 appropriate, etc., so that articles are transmitted quickly, and
23 manages the retransmission of its own backlog. innduct includes the
24 locking necessary to avoid multiple simutaneous invocations.
26 By default, innduct reads the default feedfile corresponding to
30 .IR pathoutgoing / site )
31 and feeds it via NNTP, streaming if possible, to the host
35 is not specified, it defaults to
38 innduct daemonises after argument parsing, and all logging (including
39 error messages) are sent to syslog (facility
42 The best way to run innduct is probably to periodically invoke innduct
43 for each feed (e.g. from cron), passing the
45 option to arrange that innduct silently exits if an instance is
46 already running for that site.
47 .SH INNDUCT VS INNFEED/NNTPSEND/INNXMIT
50 does roughly the same thing as innduct. However, the way it receives
51 information from innd can result in articles being lost (not offered
52 to peers) if innfeed crashes for any reason. This is an inherent
53 defect in the innd channel feed protocol. innduct uses a file feed,
54 constantly "tailing" the feed file, and where implemented uses
56 to reduce the latency which would come from having to constantly poll
57 the feed file. innfeed is capable of feeding multiple peers from a
58 single innfeed instance, whereas each innduct process handles exactly
59 one peer. innduct is much smaller and simpler, at <4kloc to innfeed's
60 25kloc. innfeed needs a separate wrapper script or similar
61 infrastructure (of which there is an example in its manpage), whereas
62 innduct can be run directly and doesn't need help from shell scripts.
65 processes feed files in batch mode. That is, you have to periodically
66 invoke nntpsend, and when you do, the feed is flushed and articles
67 which arrived before the flush are sent to the peer. This introduces
68 a batching delay, and also means that the NNTP connection to the peer
69 needs to be remade at each batch. nntpsend (which uses innxmit)
70 cannot make use of multiple connections to a single peer site.
71 However, nntpsend can be left to find automatically which sites need
76 is the actual NNTP feeder program used by nntpsend.
79 .BR \-f | \-\-feedfile= \fIpath\fR
82 to read, and indirectly specifies the paths to
83 be used for various ancillary files (see FILES, below).
88 it is taken as a directory to use, and the actual feed file used is
94 it is taken to be relative to
100 .BR \-q | \-\-quiet-multiple
101 Makes innduct silently exit (with status 0) if another innduct holds
102 the lock for the site. Without \fB-q\fR, this causes a fatal error to
103 be logged and a nonzero exit.
106 Do not daemonise. innduct runs in the foreground and all messages
107 (including all debug messages) are written to stderr. A control
108 command line is also available on stdin/stdout.
111 Do not try to use the streaming extensions to NNTP (for use eg if the
112 peer can't cope when we send MODE STREAM).
115 Do not try to use the file change monitoring support to watch for
116 writes by innd to the feed file; poll it instead. (If file monitoring
117 is not compiled in, this option just downgrades the log message which
118 warns about this situation.)
120 .BR \-C | \-\-inndconf= \fIFILE\fR
123 instead of the default
129 at the remote site rather than to the NNTP port (119).
131 .BI \-\-chdir= pathrun
134 at startup. The default is
138 .BR \-\-cli= \fICLI-DIR\fR / |\fICLI-PATH\fR| none
139 Listen for control command line connections on
141 (if the value ends with a
145 (if it doesn't). See CONTROLLING INNDUCT, below.
146 Note that there is a fairly short limit on the paths to AF_UNIX
147 sockets. If specified as
149 the directory will be created with mode 700 if necessary.
152 which means to create that directory in
155 .RB \fIpathrun\fR /innduct/ \fIsite\fR.
158 Just print a brief usage message and list of the options to stdout.
160 You should not normally need to adjust these. Time intervals may
161 specified in seconds, or as a number followed by one of the following
164 .BR "sec min hour day" ,
167 .BI \-\-max-connections= max
168 Restricts the maximum number of simultaneous NNTP connections used by
173 There is no global limit on the number of connections.
175 .BI \-\-max-queue-per-conn= per-conn-max
176 Restricts the maximum number of outstanding articles queued on any
177 particular connection to
179 (Non-streaming connections can only handle one article at a time.)
183 .BI \-\-max-queue-per-file= max
184 Restricts the maximum number articles read into core from any one
187 The default is twice the value of per-conn-max.
189 .BI \-\-feedfile-flush-size= bytes
190 Specifies that innduct should flush the feed and start a new feedfile
191 when the existing feedfile size exceeds
193 the effect is that the innduct will try to avoid the various
194 batchfiles growing much beyond this size while the link to the peer is
195 working. The default is
198 .BI \-\-period-interval= PERIOD-INTERVAL
199 Specifies wakup interval and period granularity.
200 innduct wakes up every
202 to do various housekeeping checks. Also, many of the timeout and
203 rescan intervals (those specified in this manual as
205 are rounded up to the next multiple of
206 .IR PERIOD-INTERVAL .
208 .BI \-\-connection-timeout= TIME
209 How long to allow for a connection setup attempt before giving up.
213 .BI \-\-stuck-flush-timeout= TIME
214 How long to wait for innd to respond to a flush request before giving
218 .BI \-\-feedfile-poll= TIME
219 How often to poll the feedfile for new articles written by innd
222 or equivalent) is not available. (When file monitoring is available,
223 there is no need for periodic checks and we wake immediately up
224 whenever the feedfile changes.)
228 .BI \-\-no-check-proportion= PERCENT
229 If the moving average of the proportion of articles being accepted
230 (rather than declined) by the peer exceeds this value, innduct uses
231 "no check mode" - ie it just sends the peer the articles with TAKETHIS
232 rather than checking first with CHECK whether the article is wanted.
233 This only affects streaming connections. The default is
237 .BI \-\-no-check-response-time= ARTICLES
238 The moving average mentioned above is an alpha-smoothed value with a
244 .BI \-\-reconnect-interval= RECONNECT-PERIOD
245 Limits initiation of new connections to one each
246 .IR RECONNECT-PERIOD .
247 This applies to reconnections if the peer has been down, and also to
248 ramping up the number of connections we are using after startup or in
249 response to an article flood. The default is
252 .BI \-\-flush-retry-interval= PERIOD
253 If our attempt to flush the feed failed (usually this will be because
254 innd is not running), try again after
259 .BI \-\-earliest-deferred-retry= PERIOD
260 When the peer responds to our offer of an article with a 431 or 436
261 NNTP response code, indicating that the article has already been
262 offered to it by another of its peers, and that we should try again,
265 before offering the article again. The default is
268 .BI \-\-backlog-rescan-interval= BACKLOG-SCAN-PERIOD
269 We scan the directory containing
271 for backlog files at least every
272 .IR BACKLOG-SCAN-PERIOD ,
273 in case the administrator has manually dropped in a file there for
277 .BI \-\-max-flush-interval= PERIOD
278 We flush the feed at least every
280 even if the current instance of the feedfile has not reached the size
285 .BI \-\-max-flush-interval= PERIOD
286 We flush the feed and start a new feedfile at least every
288 even if the current instance of the feedfile has not reached the size
293 .BI \-\-flush-finish-timeout= FLUSH-FINISH-PERIOD
295 .IR FLUSH-FINISH-PERIOD
296 ago, and are still trying to finish processing articles that were
297 written to the old feed file, we forcibly and violently make sure that
298 we do by abandoning and deferring all the work (which includes
299 unceremoniously dropping any connections on which we've sent some of
300 those articles but not yet had replies, as they're probably stuck
305 .BI \-\-idle-timeout= PERIOD
306 Connections which have had no activity for
308 will be closed. This includes connections where we have sent commands
309 or articles but have not yet had the responses, so this same value
310 doubles as the timeout after which we conclude that the peer is
311 unresponsive or the connection has become broken.
315 .BI \-\-max-bad-input-data-ratio= PERCENT
316 We tolerate up to this proportion of badly-formatted lines in the
317 feedfile and other input files. Every badly-formatted line is logged,
318 but if there are too many we conclude that the corruption to our
319 on-disk data is too severe, and crash; to successfully restart,
320 administrator intervention will be required. This avoids flooding the
321 logs with warnings and also arranges to abort earlyish if an attempt
322 is made to process a file in the wrong format.
327 .BI \-\-max-bad-input-data-init= LINES
328 Additionally, we tolerate this number of additional badly-formatted
329 lines, so that if the badly-formatted lines are a few but at the start
330 of the file, we don't crash immediately.
333 (which would suffice to ignore one whole corrupt 4096-byte disk block
334 filled with random data, or one corrupt 1024-byte disk block filled
335 with an inappropriate text file with a mean line length of at least
337 .SH CONTROLLING INNDUCT
338 If you tell innd to drop the feed, innduct will (when it notices,
339 which will normally be the next time it decides flushes) finish up the
340 articles it has in hand now, and then exit. It is harmless to cause
341 innd to flush the feed (but innduct won't notice and flushing won't
342 start a new feedfile; you have to leave that to innduct).
344 If you want to stop innduct you can send it SIGTERM or SIGINT, or the
346 control command, in which case it will report statistics so far and
347 quickly exit. If innduct receives SIGKILL nothing will be broken or
348 corrupted; you just won't see some of the article stats.
350 innduct listens on an AF_UNIX socket, and provides a command-line
351 interface which can be used to trigger various events and for
352 debugging. innduct listens (by default on
353 .IR pathrun \fB/innduct/\fR site )
354 and when connected reads and writes lines (with unix line endings).
355 The cli can most easily be accessed with a program like
358 .B nc.openbsd -U /var/run/news/innduct/
365 The following control commands are supported:
368 Print a list of all the commands understood. This list includes
369 undocumented commands which mess with innduct's internal state and
370 should only be used by a developer in conjuction with the innduct
374 Start a new feed file and trigger a flush of the feed. (Or, cause
376 .I FLUSH-FINISH-PERIOD
377 to expire early, forcibly completing a previously started flush.)
380 Log statistics and exit. (Same effect as SIGTERM or SIGINT.)
383 Writes information about innduct's state to a plain text file
384 .IR feedfile \fB_dump\fR.
385 This overwrites any previous dump.
387 is a summary including general state and a list of connections;
389 also includes information about each article innduct is dealing with.
392 Requests that innduct rescan for new backlog files at the next
394 poll. Normally innduct assumes that any backlog files dropped in by
395 the administrator are not urgent and may not get around to noticing
397 .IR BACKLOG-SCAN-PERIOD .
400 Resets the connection startup delay counter so that innduct may
401 consider making a new connection to the peer right away, regardless
403 .IR RECONNECT-PERIOD .
404 A connection attempt will still only be made if innduct feels that it
405 needs one, and innduct may wait up to
407 before actually starting the attempt.
408 .IR BACKLOG-SCAN-PERIOD .
412 An instance of innduct is already running for this
419 The feed has been dropped by innd, and we (or previous innducts) have
420 successfully offered all the old articles to the peer site. Our work
424 innduct was invoked with bad options or command line arguments. The
425 error message will be printed to stderr, and also (if any options or
426 arguments were passed at all) to syslog with severity
430 Things are going wrong, hopefully shortage of memory, system file
431 table entries; disk IO problems; disk full; etc. The specifics of the
432 error will be logged to syslog with severity
434 (if syslog is working!)
437 Things are going badly wrong in an unexpected way: system calls which
438 are not expected to fail are doing so, or the protocol for
439 communicating with innd is being violated, or some such. Details will
440 be logged with severity
442 (if syslog is working!)
445 These exit statuses are used by children forked by innduct to
446 communicate to the parent. You should not see them. If you do, it is
449 innduct dances a somewhat complicated dance with innd to make sure
450 that everything goes smoothly and that there are no races. (See the
451 two ascii-art diagrams in innduct.c for details of the protocol.) Do
452 not mess with the feedfile and other associated files, other than as
456 .IX Item "default directory"
457 Default current working directory for innduct, and also default
458 parent directory for the command line socket.
459 .IP \fIpathoutgoing\fR/\fIsite\fR
460 .IX Item "default feedfile"
465 Main feed file as specified in
467 This and other batchfiles used by innduct contains lines each of which
469 \& \fItoken\fR \fImessageid\fR
470 where \fItoken\fR is the inn storage API token. Such lines can be
471 written by \fBTf,Wnm\fR in a \fInewsfeeds\fR(5) entry. During
472 processing, innduct overwrites lines in the batch files which
473 correspond to articles it has processed: the line is replaced with
474 one containing only spaces. Only innd should create this file, and
475 only innduct should remove it.
476 .IP \fIfeedfile\fR_lock
478 Lockfile, preventing multiple innduct invocations for the same
479 feed. A process holds this lock after it has opened the lockfile,
480 made an fcntl F_SETLK call, and then checked with stat and fstat that
481 the file it now has open and has locked still has the name
482 \fIfeedfile\fR_lock. (Only) the lockholder may delete the lockfile.
483 For your convenience, after the lockfile is locked,
490 are all written to the lockfile. NB that stale lockfiles may contain
491 stale data so this information should not be relied on other than for
493 .IP \fIfeedfile\fR_flushing
494 .IX Item "flushing file"
495 Batch file: the main feedfile is renamed to this filename by innduct
496 before it asks inn to flush the feed. Only innduct should create or
498 .IP \fIfeedfile\fR_defer
499 .IX Item "flushing file"
500 Batch file containing details of articles whose transmission has
501 recently been deferred at the request of the recipient site. Created,
502 written, read and removed by innduct.
503 .IP \fIfeedfile\fR_backlog.\fItime_t\fR.\fIinum\fR
504 .IX Item "backlog file"
505 Batch file containing details of articles whose transmission has less
506 recently been deferred at the request of the recipient site. Created
507 by innduct, and will also be read and removed by innduct. However you
508 (the administrator) may also safely remove backlog files.
509 .IP \fIfeedfile\fR_backlog\fIsomething\fR
510 .IX Item "manual backlog file"
511 Batch file manually provided by the administrator. The file should be
512 complete and ready to process at the time it is renamed or hardlinked
513 to this name. innduct will then automatically find and read and
514 process it and eventually remove it. The administrator may also
515 safely remove backlog files. \fIsomething\fR may not contain \fB#\fR
516 \fB~\fR or \fB/\fR. Be sure to have finished writing the file before
517 you rename it to match the pattern \fIfeedfile\fR\fB_backlog\fR*, as
518 otherwise innduct may find and process the file and read it to EOF
519 before you have finished creating it.
520 .IP \fIpathrun\fR\fB/innduct/\fB\fIsite\fR
521 .IX Item "control command line socket"
522 Default AF_UNIX listening socket for the control command line. See
523 CONTROLLING INNDUCT, above.
524 .IP \fIfeedfile\fR_dump
525 .IX Item "debug dump file"
526 On request via a control connection innduct dumps a summary of its
527 state to this text file. This is mostly useful for debugging.
528 .IP /etc/news/inn.conf
534 and associated paths),
540 for finding how to communicate with innd, and also for
545 Written by Ian Jackson <ijackson@chiark.greenend.org.uk>