- <varlistentry>
- <term><option>prerun</option></term>
- <listitem>
- <para>Optional; string</para>
- <para>
- If specified, then this command will be ran after a
- client has connected to the server (and has been
- accepted), but before the server starts serving. If
- the command contains the literal string '%s', then
- this string will be replaced by the filename of the
- file which nbd-server wants to export.
- </para>
- <para>
- This is useful to create export files on the fly, or
- to verify that a file can be used for export, to
- write something to a log file, or similar.
- </para>
- <para>
- If the command runs with a non-zero exit status,
- then nbd-server will assume the export will fail,
- and refuse to serve it.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><option>postrun</option></term>
- <listitem>
- <para>Optional; string</para>
- <para>
- If specified, then it is assumed to be a command
- that will be ran when a client has
- disconnected. This can be useful to clean up
- whatever <option>prerun</option> has set up, to log
- something, or similar.
- </para>
- <para>
- If the literal string '%s' is present in the
- command, it will be replaced by the file name that
- has just been closed.
- </para>
- <para>
- In contrast to the <option>prerun</option> option,
- the exit state of <option>postrun</option> is
- <emphasis>ignored</emphasis>.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><option>maxconnections</option></term>
- <listitem>
- <para>Optional; integer</para>
- <para>
- If specified, then it limits the number of opened connections for
- this export.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><option>transactionlog</option></term>
- <listitem>
- <para>Optional; string</para>
- <para>
- If specified, then this pathname is used to generate a transaction
- log. A transaction log is a binary file consisting of the requests
- sent to and the replies received by the server, but excluding any
- data (so, for a write command, it records the offset and length
- of the write but not the data written). It is therefore relatively
- safe to distribute to a third party. Note that the transaction log
- does not include the negotiation sequence. Transaction logs are
- mainly useful for debugging. The program
- <emphasis>nbd-tester-client</emphasis> distributed with the source
- to this program can reply a transaction log against a server and
- perform a data integrity test. Note that the transaction log is
- written to for every client opened. If it is necessary to maintain
- separate transaction logs for each client, the
- <emphasis>prerun</emphasis> script should rename the transaction log
- (which will just have been opened in order to avoid transaction logs
- overwriting eachother. This action should be race-free.
- </para>
- </listitem>
- </varlistentry>