Crdb utility

From Messaging Server Technical Reference Wiki
Jump to: navigation, search

imsimta crdbis a utility used to create and update MTA (on-disk) database files.

Syntax

  imsimta crdb input-file-spec output-database-spec
imsimta crdb Command Switches
Switch Default
-append -noappend
-count -count
-dump See text
-duplicates -noduplicates
-exception_file=file-spec -noexception_file
-huge_records -huge_records
-long_records -nolong_records
-quoted -noquoted
-remove -noremove
-statistics -statistics
-strip_colons -nostrip_colons

Parameters

input-file-spec

A text file containing the entries to be placed into the database. Each line of the text file must correspond to a single entry.

output-database-spec

The initial name string of the file to which to write the database; the database will consist of a file named output-database-spec.db.

Description

imsimta crdbis a utility to create and or update MTA (on disk) database files. imsimta crdb simply converts a plain text file into MTA database records and from them either creates a new database or adds the records to an existing database.

On UNIX, if run from the root account, imsimta crdb will set the ownership of the database it creates to the MTA user account; see the user option from the restricted.cnf file, or in older versions of the MTA, see the imta_user MTA Tailor option. If run from an unprivileged account, then the database will be owned by that unprivileged user.

In general, each line of the input file must consist of a left hand side and a right hand side. The two sides are separated by one or more spaces or tabs. The left hand side is limited to 32 characters in a short database (the default variety) and 80 characters in a long database. The right hand side is limited to 80 characters in a short database and 256 in a long database. Spaces and tabs may not appear in the left hand side (but see the description of the -quoted switch below).

The format of the input file is described in the sections describing each particular MTA database. For instance, the format of the input file for an alias database is described in Alias database format; the format of the input file for the domain database (rewrite rule database) is described in Domain database; the format of the input file for the forward database is described in Forward database; the format of the input file for the general database is described in General database; the format of the input file for the address reversal database is described in Reverse database.

Switches

-append, -noappend (default)

When the default, -noappend, switch is in effect, a new database is created, overwriting any old database of that name. Use the -append switch to instruct the MTA to instead add the new records to an existing database.

-count (default), -nocount

Controls whether or not a count is output after each group of 100 input lines are processed.

-dump

imsimta crdb -dumpis a synonym for imsimta dumpdb. It is used to dump an existing database to a flat text file---or to stdout if no output file is specified. The parameters are interpreted as the input database specification, and optionally a flat text file to which to write the output. No other switches are valid when -dump is specified.

-duplicates, -noduplicates (default)

Controls whether or not duplicate records are allowed in the output files. Currently duplicate records are of use only in the domain database (rewrite rules database) and databases associated with the directory channel.

-exception_file=file-spec, -noexception_file (default)

imsimta crdbmay encounter records that cannot be loaded into the database. This usually means that these records had keys (left hand sides) that were duplicates of other keys previously encountered in the input file. These exception records can optionally be written to a separate output file for later examination; the -exceptions_file switch controls the writing of this file. Note that the lines in this file are not plain text; they are formatted as database entries.

-long_records, -nolong_records (default), -⁠huge_records, -nohuge_records

These switches control the size of the output records. By default left hand sides are limited to 32 characters and right hand sides are limited to 80 characters. If -long_records is specified, the limits are changed to 80 and 256, respectively. If -huge_records is specified, the limits are changed to 252 and 1024, respectively. Currently, -huge_records databases are supported only for the alias database.

-quoted, -noquoted (default)

This switch controls the handling of quotes. Normally imsimta crdb pays no particular attention to double quotes. If -quoted is specified, imsimta crdb matches up double quotes in the process of determining the break between the left and right hand sides of each input line. Spaces and tabs are then allowed in the left hand side if they are within a matching pair of quotes. This is useful for certain kinds of databases, where spaces may form a part of database keys. Note: The quotes are not removed unless the -remove switch is also specified.

-remove, -noremove (default)

These switches control the removal of quotes. If imsimta crdb is instructed to pay attention to quotes, the quotes are normally retained. If -remove is specified, imsimta crdb removes the outermost set of quotes from the left hand side of each input line. Spaces and tabs are then allowed in the left hand side if they are within a matching pair of quotes. This is useful for certain kinds of databases, where spaces may form a part of database keys. Note: -remove is ignored if -quoted is not in effect.

-statistics (default), -nostatistics

Controls whether or not some simple statistics are output by imsimta crdb, including the number of entries (lines) converted, the number of exceptions (usually duplicate records) detected, and the number of entries that could not be converted because they were too long to fit in the output database. -nostatistics suppresses output of this information.

-strip_colons, -nostrip_colons (default)

The -strip_colons switch instructs imsimta crdb to strip a trailing colon from the right end of the left hand side of each line it reads from the input file. This is useful for turning alias file entries into an alias database.

Examples


# imsimta crdb -long_records IMTA_DATAROOT:db/aliases.txt IMTA_DATAROOT:db/tmpdb
# imsimta renamedb IMTA_DATAROOT:db/tmpdb IMTA_DATAROOT:db/aliasesdb

The above example shows UNIX commands that may be used to create an alias database with "long" record entries; note that the creation is performed in a two-step process using a temporary database to minimize any window of time, such as during database generation, when the database would be locked and inaccessible to the MTA.


See also: