1BUFFCHAN(8) InterNetNews Documentation BUFFCHAN(8)
2
3
4
6 buffchan - Buffered file-writing backend for INN
7
9 buffchan [-bru] [-c lines] [-C seconds] [-d directory] [-f num-fields]
10 [-l lines] [-L seconds] [-m map] [-p pid-file] [-s format]
11
13 buffchan reads lines from standard input and copies the initial fields
14 in each line to the files named by the remaining fields on the line.
15 buffchan is intended to be called by innd as an exploder feed.
16
17 The input is interpreted as a sequence of lines. Each line contains a
18 fixed number of initial fields, followed by a variable number of
19 filename fields. All fields in a line are separated by whitespace and
20 do not contain any whitespace. The default number of initial fields is
21 one.
22
23 For each line of input, buffchan writes the initial fields, separated
24 by a space and followed by a newline, to each of the files named in the
25 filename fields. The output files are kept open and are only flushed
26 or closed based on the schedule given by the -c, -C, -l, and -L
27 options.
28
29 As an exploder feed (see newsfeeds(5) for an explanation), buffchan
30 interprets lines beginning with an exclamation point as commands.
31 Besides "!begin" (which only marks the start of the feed), there are
32 three supported commands:
33
34 !flush [site]
35 The flush command closes and reopens all open files. An optional
36 site can be specified, in which case buffchan flushes only that
37 file. This command is analogous to the "ctlinnd flush" command.
38 This command can be sent via innd using "ctlinnd send buffchan-site
39 'flush site'".
40
41 Applications can tell that flush has completed by renaming the file
42 before issuing the command. When the original file name has
43 reappeared, the flush is complete. If fchmod(3) is available,
44 buffchan also changes the file to read-only while it's actively
45 writing to it and changes it back to read/write once it has been
46 closed. It will change the mode back to read-only only if it
47 reopens the same file.
48
49 !drop [site]
50 The drop command is similar to the flush command, except that no
51 files are reopened. If given an argument, only the specified site
52 is dropped; otherwise, all sites are dropped. (Note that a site
53 will be restarted if the input stream mentions the site again.)
54
55 When a "ctlinnd drop site" command is sent, innd will automatically
56 forward the command to buffchan if the site is listed as a funnel
57 feeding into the buffchan exploder. To drop all sites, use
58 "ctlinnd send buffchan-site drop".
59
60 !readmap
61 The map file specified with the -m option, if given, will be
62 reloaded.
63
64 Once buffchan opens a file, it keeps it open (in the absence of a drop
65 command). The input must therefore never specify more files than the
66 maximum number of files a process may open.
67
69 -b Force the output to be buffered. (This is generally the default,
70 but it may depend on the operating system.) If -b is given, a
71 buffer size of BUFSIZ (a constant of the system standard I/O
72 library) is used.
73
74 -c lines
75 If the -c flag is given, buffchan will close and reopen a file
76 after every lines lines are written to the file.
77
78 -C seconds
79 If the -C flag is given, buffchan will close and reopen a file if
80 it has been open for more than seconds seconds.
81
82 -d directory
83 By default, buffchan writes its output into the pathoutgoing
84 directory. This flag may be used to specify a directory the
85 program should change to before starting. If this flag is used,
86 the default for the -s flag (see below) is changed to be a simple
87 %s (in other words, output files are considered to be relative to
88 directory).
89
90 -f num-fields
91 By default, each line is expected to contain one fixed field
92 followed by some number of filename fields. If this flag is given,
93 num-fields will be used as the number of initial fixed fields.
94
95 -l lines
96 If the -l flag is given, buffchan will flush the output after every
97 lines lines are written to a file.
98
99 -L seconds
100 If the -L flag is given, buffchan will flush each output file every
101 seconds seconds.
102
103 -m map
104 Map files translate the names in the filename fields on each line
105 into filenames that should be used instead. It's used primarily
106 when short names are used in newsfeeds, but the output files should
107 use the full domain names of remote peers.
108
109 In the map file, blank lines and lines starting with a number sign
110 ("#") are ignored. All other lines should have two host names
111 separated by a colon. The first field is the name that may appear
112 in the input stream; the second field names the file to be used
113 when the name in the first field appears.
114
115 For example, the following map file may be used to map the short
116 names used in the example below to the full domain names:
117
118 # This is a comment
119 uunet:news.uu.net
120 foo:foo.com
121 munnari:munnari.oz.au
122
123 -p pid-file
124 If the -p option is given, buffchan will write a line containing
125 its process ID (in text) to the specified file when it starts.
126
127 -r By default, buffchan sends its error messages to pathlog/errlog.
128 To suppress this redirection and send error messages to standard
129 error, use the -r flag.
130
131 -s The -s flag may be used to specify a format that maps a filename
132 from the filename fields at the end of each line to an actual
133 filename. This is a sprintf(3) format string that should contain a
134 single instance of %s, which will be replaced with the value of the
135 filename field (possibly after mapping with the map file from -m).
136 The default value is pathoutgoing/%s.
137
138 -u If the -u flag is used, the output will be unbuffered.
139
141 If buffchan is invoked with "-f 2" and given the following input:
142
143 news.software.nntp <1643@munnari.oz.au> foo uunet
144 news.software.nntp <102060@litchi.foo.com> uunet munnari
145 comp.sources.unix <999@news.foo.com> foo uunet munnari
146
147 then the file foo in pathoutgoing will have these lines:
148
149 news.software.nntp <1643@munnari.oz.au>
150 comp.sources.unix <999@news.foo.com>
151
152 the file munnari in pathoutgoing will have these lines:
153
154 news.software.nntp <102060@litchi.foo.com>
155 comp.sources.unix <999@news.foo.com>
156
157 and the file uunet in pathoutgoing will have these lines:
158
159 news.software.nntp <1643@munnari.oz.au>
160 news.software.nntp <102060@litchi.foo.com>
161 comp.sources.unix <999@news.foo.com>
162
163 Using buffchan this way can be done in newsfeeds with for instance:
164
165 foo:*,@misc.*:Ap,Tm:buffchan!
166 munnari:*,@rec.*:Ap,Tm:buffchan!
167 uunet:*:Ap,Tm:buffchan!
168 buffchan!:*:Tx,WGm*:<pathbin>/buffchan -f 2
169
170 It will generate the examples above. See the "W" flag in newsfeeds(5)
171 for how to parameter the output.
172
174 Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews. Converted
175 to POD by Russ Allbery <eagle@eyrie.org>.
176
178 ctlinnd(8), inn.conf(5), innd(8), newsfeeds(5).
179
180
181
182INN 2.7.0 2022-07-10 BUFFCHAN(8)