chiark / gitweb /
manpage fixes
[innduct.git] / doc / man / innduct.8
1 .TH INNDUCT 8
2 .SH NAME
3 innduct \- quickly and reliably stream Usenet articles to remote site
4 .SH SYNOPSIS
5 .B innduct
6 .RI [ options ]
7 .I site
8 .RI [ fqdn ]
9 .SH DESCRIPTION
10 .B innduct
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
14 .I innfeed
15 or
16 .IR nntpsend
17 and
18 .IR innxmit .
19
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.
25
26 By default, innduct reads the default feedfile corresponding to
27 the site
28 .I site
29 (ie
30 .IR pathoutgoing / site )
31 and feeds it via NNTP, streaming if possible, to the host
32 .IR fqdn .
33 If
34 .I fqdn
35 is not specified, it defaults to
36 .IR site .
37
38 innduct daemonises after argument parsing, and all logging (including
39 error messages) are sent to syslog (facility
40 .BR news ).
41
42 The best way to run innduct is probably to periodically invoke innduct
43 for each feed (e.g. from cron), passing the
44 .B \-q
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
48 .TP
49 .B innfeed
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
55 .BR inotify (2)
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.
63 .TP
64 .B nntpsend
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
72 feeding by looking in
73 .IR pathoutgoing .
74 .TP
75 .B innxmit
76 is the actual NNTP feeder program used by nntpsend.
77 .SH GENERAL OPTIONS
78 .TP
79 .BR \-f | \-\-feedfile= \fIfeedfile\fR
80 Specifies
81 .IR feedfile .
82 If the specified value ends in a
83 .B /
84 it is taken as a directory to use as if it were
85 .I pathoutgoing
86 and the actual feed file used is
87 .IR specified_feedfile / site .
88 .TP
89 .BR \-q | \-\-quiet-multiple
90 Makes innduct silently exit (with status 0) if another innduct holds
91 the lock for the site.  Without \fB-q\fR, this causes a fatal error to
92 be logged and a nonzero exit.
93 .TP
94 .BR \-\-no-daemon
95 Do not daemonise.  innduct runs in the foreground and all messages
96 (including all debug messages) are written to stderr.  A control
97 command line is also available on stdin/stdout.
98 .TP
99 .BI \-\-no-streaming
100 Do not try to use the streaming extensions to NNTP (for use eg if the
101 peer can't cope when we send MODE STREAM).
102 .TP
103 .BI \-\-no-filemon
104 Do not try to use the file change monitoring support to watch for
105 writes by innd to the feed file; poll it instead.  (If file monitoring
106 is not compiled in, this option just downgrades the log message which
107 warns about this situation.)
108 .TP
109 .BR \-C | \-\-inndconf= \fIFILE\fR
110 Read
111 .I FILE
112 instead of the default
113 .BR inn.conf .
114 .TP
115 .BI \-\-port= PORT
116 Connect to port
117 .I PORT
118 at the remote site rather than to the NNTP port (119).
119 .TP
120 .BI \-\-chdir= pathrun
121 Change directory to
122 .IR pathrun
123 at startup.  The default is
124 .I pathrun
125 from inn.conf.
126 .TP
127 .BR \-\-cli= \fICLI-DIR\fR / |\fICLI-PATH\fR| none
128 Listen for control command line connections on
129 .IB CLI-DIR / site
130 (if the value ends with a
131 .BR /)
132 or
133 .I CLI-PATH
134 (if it doesn't).  See CONTROLLING INNDUCT, below.
135 Note that there is a fairly short limit on the paths to AF_UNIX
136 sockets.  If specified as
137 .IR CLI-DIR \fB/\fR,
138 the directory will be created with mode 700 if necessary.
139 The default is
140 .B innduct/
141 which means to create that directory in
142 .I pathrun
143 and listen on
144 .RB \fIpathrun\fR /innduct/ \fIsite\fR.
145 .TP
146 .BI \-\-help
147 Just print a brief usage message and list of the options to stdout.
148 .SH TUNING OPTIONS
149 You should not normally need to adjust these.  Time intervals may
150 specified in seconds, or as a number followed by one of the following
151 units:
152 .BR "s m h d" ,
153 .BR "sec min hour day" ,
154 .BR "das hs ks Ms" .
155 .TP
156 .BI \-\-max-connections= max
157 Restricts the maximum number of simultaneous NNTP connections used by
158 for each site to
159 .IR max .
160 The default is
161 .BR 10 .
162 There is no global limit on the number of connections.
163 .TP
164 .BI \-\-max-queue-per-conn= per-conn-max
165 Restricts the maximum number of outstanding articles queued on any
166 particular connection to
167 .IR max .
168 (Non-streaming connections can only handle one article at a time.)
169 The default is
170 .BR 200 .
171 .TP
172 .BI \-\-max-queue-per-file= max
173 Restricts the maximum number articles read into core from any one
174 input file to
175 .IR max .
176 The default is twice the value of per-conn-max.
177 .TP
178 .BI \-\-feedfile-flush-size= bytes
179 Specifies that innduct should flush the feed and start a new feedfile
180 when the existing feedfile size exceeds
181 .IR bytes ;
182 the effect is that the innduct will try to avoid the various
183 batchfiles growing much beyond this size while the link to the peer is
184 working.  The default is
185 .BR 100000 .
186 .TP
187 .BI \-\-period-interval= PERIOD-INTERVAL
188 Specifies wakup interval and period granularity.
189 innduct wakes up every
190 .I PERIOD-INTERVAL
191 to do various housekeeping checks.  Also, many of the timeout and
192 rescan intervals (those specified in this manual as
193 .IR PERIOD )
194 are rounded up to the next multiple of
195 .IR PERIOD-INTERVAL .
196 .TP
197 .BI \-\-connection-timeout= TIME
198 How long to allow for a connection setup attempt before giving up.
199 The default is
200 .BR 200s .
201 .TP
202 .BI \-\-stuck-flush-timeout= TIME
203 How long to wait for innd to respond to a flush request before giving
204 up.  The default is
205 .BR 100s .
206 .TP
207 .BI \-\-feedfile-poll= TIME
208 How often to poll the feedfile for new articles written by innd
209 if file monitoring
210 .RI ( inotify
211 or equivalent) is not available.  (When file monitoring is available,
212 there is no need for periodic checks and we wake immediately up
213 whenever the feedfile changes.)
214 The default is
215 .BR 5s .
216 .TP
217 .BI \-\-no-check-proportion= PERCENT
218 If the moving average of the proportion of articles being accepted
219 (rather than declined) by the peer exceeds this value, innduct uses
220 "no check mode" - ie it just sends the peer the articles with TAKETHIS
221 rather than checking first with CHECK whether the article is wanted.
222 This only affects streaming connections.  The default is
223 .B 95
224 (ie, 95%).
225 .TP
226 .BI \-\-no-check-response-time= ARTICLES
227 The moving average mentioned above is an alpha-smoothed value with a
228 half-life of
229 .IR ARTICLES .
230 The default is
231 .BR 100 .
232 .TP
233 .BI \-\-reconnect-interval= RECONNECT-PERIOD
234 Limits initiation of new connections to one each
235 .IR RECONNECT-PERIOD .
236 This applies to reconnections if the peer has been down, and also to
237 ramping up the number of connections we are using after startup or in
238 response to an article flood.  The default is
239 .BR 1000s .
240 .TP
241 .BI \-\-flush-retry-interval= PERIOD
242 If our attempt to flush the feed failed (usually this will be because
243 innd is not running), try again after
244 .IR PERIOD .
245 The default is
246 .BR 1000s .
247 .TP
248 .BI \-\-earliest-deferred-retry= PERIOD
249 When the peer responds to our offer of an article with a 431 or 436
250 NNTP response code, indicating that the article has already been
251 offered to it by another of its peers, and that we should try again,
252 we wait at least
253 .IR PERIOD .
254 before offering the article again.  The default is
255 .BR 50s .
256 .TP
257 .BI \-\-backlog-rescan-interval= BACKLOG-SCAN-PERIOD
258 We scan the directory containing
259 .I feedfile
260 for backlog files at least every
261 .IR BACKLOG-SCAN-PERIOD ,
262 in case the administrator has manually dropped in a file there for
263 processing.
264 The default is
265 .TP
266 .BI \-\-max-flush-interval= PERIOD
267 We flush the feed at least every
268 .IR PERIOD
269 even if the current instance of the feedfile has not reached the size
270 threshold.
271 The default is
272 .BR 100000s .
273 .TP
274 .BI \-\-max-flush-interval= PERIOD
275 We flush the feed and start a new feedfile at least every
276 .IR PERIOD
277 even if the current instance of the feedfile has not reached the size
278 threshold.
279 The default is
280 .BR 100000s .
281 .TP
282 .BI \-\-flush-finish-timeout= FLUSH-FINISH-PERIOD
283 If we flushed
284 .IR FLUSH-FINISH-PERIOD
285 ago, and are still trying to finish processing articles that were
286 written to the old feed file, we forcibly and violently make sure that
287 we do by abandoning and deferring all the work (which includes
288 unceremoniously dropping any connections on which we've sent some of
289 those articles but not yet had replies, as they're probably stuck
290 somehow).
291 The default is
292 .BR 2000s .
293 .TP
294 .BI \-\-idle-timeout= PERIOD
295 Connections which have had no activity for
296 .IR PERIOD
297 will be closed.  This includes connections where we have sent commands
298 or articles but have not yet had the responses, so this same value
299 doubles as the timeout after which we conclude that the peer is
300 unresponsive or the connection has become broken.
301 The default is
302 .BR 1000s .
303 .TP
304 .BI \-\-max-bad-input-data-ratio= PERCENT
305 We tolerate up to this proportion of badly-formatted lines in the
306 feedfile and other input files.  Every badly-formatted line is logged,
307 but if there are too many we conclude that the corruption to our
308 on-disk data is too severe, and crash; to successfully restart,
309 administrator intervention will be required.  This avoids flooding the
310 logs with warnings and also arranges to abort earlyish if an attempt
311 is made to process a file in the wrong format.
312 The default is
313 .BR 1
314 (ie, 1%).
315 .TP
316 .BI \-\-max-bad-input-data-init= LINES
317 Additionally, we tolerate this number of additional badly-formatted
318 lines, so that if the badly-formatted lines are a few but at the start
319 of the file, we don't crash immediately.
320 The default is
321 .BR 30
322 (which would suffice to ignore one whole corrupt 4096-byte disk block
323 filled with random data, or one corrupt 1024-byte disk block filled
324 with an inappropriate text file with a mean line length of at least
325 35).
326 .SH CONTROLLING INNDUCT
327 If you tell innd to drop the feed, innduct will (when it notices,
328 which will normally be the next time it decides flushes) finish up the
329 articles it has in hand now, and then exit.  It is harmless to cause
330 innd to flush the feed (but innduct won't notice and flushing won't
331 start a new feedfile; you have to leave that to innduct).
332 .LP
333 If you want to stop innduct you can send it SIGTERM or SIGINT, or the
334 .B stop
335 control command, in which case it will report statistics so far and
336 quickly exit.  If innduct receives SIGKILL nothing will be broken or
337 corrupted; you just won't see some of the article stats.
338 .LP
339 innduct listens on an AF_UNIX socket, and provides a command-line
340 interface which can be used to trigger various events and for
341 debugging.  innduct listens (by default on
342 .IR pathrun \fB/innduct/\fR site )
343 and when connected reads and writes lines (with unix line endings).
344 The cli can most easily be accessed with a program like
345 .I netcat-openbsd
346 (eg
347 .B nc.openbsd -U /var/run/news/innduct/
348 .IR site )
349 or
350 .IR socat .
351 The prompt is
352 .IR site \fB|\fR.
353 .LP
354 The following control commands are supported:
355 .TP
356 .B h
357 Print a list of all the commands understood.  This list includes
358 undocumented commands which mess with innduct's internal state and
359 should only be used by a developer in conjuction with the innduct
360 source code.
361 .TP
362 .B flush
363 Start a new feed file and trigger a flush of the feed.  (Or, cause
364 the
365 .I FLUSH-FINISH-PERIOD
366 to expire early, forcibly completing a previously started flush.)
367 .TP
368 .B stop
369 Log statistics and exit.  (Same effect as SIGTERM or SIGINT.)
370 .TP
371 .BR "dump q" | a
372 Writes information about innduct's state to a plain text file
373 .IR feedfile \fB_dump\fR.
374 This overwrites any previous dump.
375 .B "dump q"
376 is a summary including general state and a list of connections;
377 .B "dump a"
378 also includes information about each article innduct is dealing with.
379 .TP
380 .B next blscan
381 Requests that innduct rescan for new backlog files at the next
382 .I PERIOD
383 poll.  Normally innduct assumes that any backlog files dropped in by
384 the administrator are not urgent and may not get around to noticing
385 them for
386 .IR BACKLOG-SCAN-PERIOD .
387 .TP
388 .B next conn
389 Resets the connection startup delay counter so that innduct may
390 consider making a new connection to the peer right away, regardless
391 of the setting of
392 .IR RECONNECT-PERIOD .
393 A connection attempt will still only be made if innduct feels that it
394 needs one, and innduct may wait up to
395 .I PERIOD
396 before actually starting the attempt.
397 .IR BACKLOG-SCAN-PERIOD .
398 .SH EXIT STATUS
399 .TP
400 .B 0
401 An instance of innduct is already running for this
402 .I feedfile
403 and
404 .B -q
405 was specified.
406 .TP
407 .B 4
408 The feed has been dropped by innd, and we (or previous innducts) have
409 successfully offered all the old articles to the peer site.  Our work
410 is done.
411 .TP
412 .B 8
413 innduct was invoked with bad options or command line arguments.  The
414 error message will be printed to stderr, and also (if any options or
415 arguments were passed at all) to syslog with severity
416 .BR crit .
417 .TP
418 .B 12
419 Things are going wrong, hopefully shortage of memory, system file
420 table entries; disk IO problems; disk full; etc.  The specifics of the
421 error will be logged to syslog with severity
422 .B err
423 (if syslog is working!)
424 .TP
425 .B 16
426 Things are going badly wrong in an unexpected way: system calls which
427 are not expected to fail are doing so, or the protocol for
428 communicating with innd is being violated, or some such.  Details will
429 be logged with severity
430 .B crit
431 (if syslog is working!)
432 .TP
433 .BR 24 - 27
434 These exit statuses are used by children forked by innduct to
435 communicate to the parent.  You should not see them.  If you do, it is
436 a bug.
437 .SH FILES
438 innduct dances a somewhat complicated dance with innd to make sure
439 that everything goes smoothly and that there are no races.  (See the
440 two ascii-art diagrams in innduct.c for details of the protocol.)  Do
441 not mess with the feedfile and other associated files, other than as
442 explained here:
443 .IX Header "FILES"
444 .IP \fIpathrun\fR
445 .IX Item "default directory"
446 Default current working directory for innduct, and also default
447 parent directory for the command line socket.
448 .IP \fIpathoutgoing\fR/\fIsite\fR
449 .IX Item "default feedfile"
450 Default
451 .IR feedfile .
452 .IP \fIfeedfile\fR
453 .IX Item feedfile
454 Main feed file as specified in
455 .IR newsfeeds (5).
456 This and other batchfiles used by innduct contains lines each of which
457 is of the form
458 \&    \fItoken\fR \fImessageid\fR
459 where \fItoken\fR is the inn storage API token.  Such lines can be
460 written by \fBTf,Wnm\fR in a \fInewsfeeds\fR(5) entry.  During
461 processing, innduct overwrites lines in the batch files which
462 correspond to articles it has processed: the line is replaced with
463 one containing only spaces.  Only innd should create this file, and
464 only innduct should remove it.
465 .IP \fIfeedfile\fR_lock
466 .IX Item "lock file"
467 Lockfile, preventing multiple innduct invocations for the same
468 feed.  A process holds this lock after it has opened the lockfile,
469 made an fcntl F_SETLK call, and then checked with stat and fstat that
470 the file it now has open and has locked still has the name
471 \fIfeedfile\fR_lock.  (Only) the lockholder may delete the lockfile.
472 For your convenience, after the lockfile is locked,
473 .IR innfeed 's
474 pid, the
475 .IR site ,
476 .IR feedfile
477 and
478 .IR fqdn
479 are all written to the lockfile.  NB that stale lockfiles may contain
480 stale data so this information should not be relied on other than for
481 troubleshooting.
482 .IP \fIfeedfile\fR_flushing
483 .IX Item "flushing file"
484 Batch file: the main feedfile is renamed to this filename by innduct
485 before it asks inn to flush the feed.  Only innduct should create or
486 remove this file.
487 .IP \fIfeedfile\fR_defer
488 .IX Item "flushing file"
489 Batch file containing details of articles whose transmission has
490 recently been deferred at the request of the recipient site.  Created,
491 written, read and removed by innduct.
492 .IP \fIfeedfile\fR_backlog.\fItime_t\fR.\fIinum\fR
493 .IX Item "backlog file"
494 Batch file containing details of articles whose transmission has less
495 recently been deferred at the request of the recipient site.  Created
496 by innduct, and will also be read and removed by innduct.  However you
497 (the administrator) may also safely remove backlog files.
498 .IP \fIfeedfile\fR_backlog\fIsomething\fR
499 .IX Item "manual backlog file"
500 Batch file manually provided by the administrator.  The file should be
501 complete and ready to process at the time it is renamed or hardlinked
502 to this name.  innduct will then automatically find and read and
503 process it and eventually remove it.  The administrator may also
504 safely remove backlog files.  \fIsomething\fR may not contain \fB#\fR
505 \fB~\fR or \fB/\fR.  Be sure to have finished writing the file before
506 you rename it to match the pattern \fIfeedfile\fR\fB_backlog\fR*, as
507 otherwise innduct may find and process the file and read it to EOF
508 before you have finished creating it.
509 .IP \fIpathrun\fR\fB/innduct/\fB\fIsite\fR
510 .IX Item "control command line socket"
511 Default AF_UNIX listening socket for the control command line.  See
512 CONTROLLING INNDUCT, above.
513 .IP \fIfeedfile\fR_dump
514 .IX Item "debug dump file"
515 On request via a control connection innduct dumps a summary of its
516 state to this text file.  This is mostly useful for debugging.
517 .IP /etc/news/inn.conf
518 .IX Item inn.conf
519 Used for
520 .IR pathoutgoing
521 (to compute default
522 .IR feedfile
523 and associated paths),
524 .IR pathrun
525 (to compute default
526 .IR CLI-DIR
527 and
528 .IR CLI-PATH ),
529 for finding how to communicate with innd, and also for
530 .IR sourceaddress
531 and/or
532 .IR sourceaddress6 .
533 .SH HISTORY
534 Written by Ian Jackson <ijackson@chiark.greenend.org.uk>
535 .SH "SEE ALSO"
536 inn.conf(5),
537 newsfeeds(5)