BATCHER(8)

NAME
batcher - Article batching for InterNetNews

SYNOPSIS
batcher [-rv] [-a articles] [-A total-articles] [-b size] [-B total-size] [-i string] [-N batches] [-p process] [-s separator] host [input]

DESCRIPTION
batcher reads a list of files and prepares news batches for the specified host. It is generally used to prepare UUCP feeds, but the resulting batches can be used by any application that uses rnews(1) to inject the articles. It is normally invoked by a script run out of cron that uses shlock to lock the host, followed by ctlinnd to flush the batch file. See send-uucp(8) for a front-end for batcher.

batcher reads the file input, or standard input if no file is given. If input is a relative file name, it is assumed to be in pathoutgoing as set in inn.conf. Blank lines and lines starting with a number sign ("#") are ignored. All other lines in the input should consist of one or two fields separated by a single space. The first field is the storage API token of an article. The second field, if present, specifies the size of the article in bytes.

By default, batches are written to standard output (which isn't very useful if more than one batch is output), but see the -p option.

OPTIONS

-a articles
    This flag limits the number of articles included in each batch. The default is no limit. A new batch will be started when either the total bytes or the number of articles written exceeds the specified limits.

-A total-articles
    Limits the total number of articles written for all batches. As soon as the total number of articles written to batches reaches or exceeds total-articles, all additional articles in the input will be deferred. The default is no limit.

-b size
    This flag sets the size limit for each batch; as soon as at least this much data has been written out, a new batch will be started. The default size is 60 KB. Using "-b 0" will allow unlimited batch sizes.

-B total-size
    Limits the total number of bytes written for all batches. As soon as the total bytes written to batches reaches or exceeds total-size, all additional articles in the input will be deferred. The default is no limit.

-i string
    A batch starts with an identifying line to specify the unpacking method to be used on the receiving end. When this flag is used, string, followed by a newline, will be output at the start of each batch. The default is to have no initial string (under the assumption that either the processor specified with the -p flag or some other later process will add the appropriate line).

-N batches
    Limits the total number of batches written. As soon as the number of batches written reaches or exceeds batches, all additional articles in the input will be deferred. The default is no limit.

-p process
    By default, batches are written to standard output, which is not useful when more than one output batch is created. If this option is given, each batch will instead be fed via a pipe to the shell command process. The process argument must be an sprintf(3) format string, which may have a single "%s" parameter that will be replaced with the host name.

    A common value is:

        ( echo '#! gunbatch' ; exec gzip -c ) | uux - -r -z %s!rnews

    which generates gzip-compressed batches and feeds them to uux.

-r  By default, batcher reports errors to pathlog/errlog. To suppress this redirection and report errors to standard error, use the -r flag.

-s separator
    Each article in a batch starts with a separator line that indicates the size of the article. separator must be an sprintf(3) string, which may have a single "%ld" in the string that will be replaced with the size of the article. If the separator is not empty, a newline will also be appended to it when it is added to the beginning of each article.

    The default separator is:

        #! rnews %ld

    and this should rarely be changed.

-v  Upon exit, batcher reports statistics via syslog. With this flag, the statistics will also be printed to standard output.

EXIT STATUS
If the input is exhausted and all batches are created successfully, batcher will exit with a zero status.

If any of the limits specified with -A, -B, or -N flags are reached, or if there is an error in writing a batch, batcher will try to spool the remaining input by copying it to a file as follows:

•   If there was no input filename, the remaining input will be copied to pathoutgoing/host.

•   If an input filename was given, the remaining input will be copied to a temporary file named by appending ".bch" to the end of input (and qualified by adding pathoutgoing if input was not a fully qualified path). If this happens successfully, batcher will then try to rename this temporary file to input (thus replacing input with a copy of itself with all of lines for the successfully batched articles removed).

Upon receipt of an interrupt or termination signal, batcher will finish batching the current article, close the batch, and then rewrite the batch file as described above.

HISTORY
Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews. Rewritten by Russ Allbery <eagle@eyrie.org> in POD.

SEE ALSO
ctlinnd(8), inn.conf(5), newsfeeds(5), rnews(1), send-uucp(8), shlock(8).