MHonArc v2.5 -- Appendix: Utility Programs

# Appendix: Utility Programs

This appendix describes the additional utility programs that are included in the MHonArc distribution. The utility programs are installed with mhonarc during the installation process.

- mha-dbedit
- mha-dbrecover
  - Additional Options
- mha-decode
  - Additional Options
  - Examples

## mha-dbedit

mha-dbedit allows modifications to be made to an archive database without regenerating any archive pages.

Typical usage:

        shell> mha-dbedit -rcfile res.mrc -outdir /path/to/archive

## mha-dbrecover

mha-dbrecover recreates an archive database from the individual message pages. This program is useful if an archive database gets corrupted, or accidentally deleted.

Typical usage:

        shell> mha-dbrecover -outdir /path/to/archive

If the archive used different resource settings from the defaults for controling filenames, then you must specify those settings when invoking mha-dbrecover. For example, if you are using "`shtml`" for HTMLEXT, then you should invoke mha-dbrecover like the following:

        shell> mha-dbrecover -htmlext shtml -outdir /path/to/archive

mha-dbrecover will only recreate non-layout message related data. If the archive had resource settings that were different than the the defaults, then those resource settings must be specified when invoking mha-dbrecover. For example:

        shell> mha-dbrecover -rcfile res.mrc -outdir /path/to/archive

### Additional Options

mha-dbrecover supports the additional command-line options:

`-dbr-startnum #`
  The starting message number to recover data from. This option is useful if you have many message files in a directory, but you only want to recover a subset of the files. If this option is not specified, the starting number is 0.

`-dbr-endnum #`
  The ending message number to recover data from. This option is useful if you have many message files in a directory, but you only want to recover a subset of the files. If this option is not specified, all messages starting from `-dbr-startnum` will be recovered.

Using the number range options are typically not needed, but may be useful if the archive is maintained with a MAXSIZE (or EXPIREAGE), and KEEPONRMM is active. The message number range options will allow you to minimize recovering processing by having mha-dbrecover skip messaages that will be dropped from the database due to the MAXSIZE, or EXPIREAGE, setting.

For example, say you have an archive directory with 1000 message pages numbered 0 through 999, and the maximum size of the archive is 200. The following command will make recovering more efficient by skipping the first 800 messages since they will be dropped from the database anyway:

        shell> mha-dbrecover -dbr-startnum 800 -outdir /path/to/archive

NOTE | It is possible that message number order may not exactly match date order. You may want to increase the number range to take in account of possible anomolies where message number order may vary from message date order.

## mha-decode

mha-decode is a utility program unrelated to MHonArc archives. mha-decode provides basic MIME decoding capabilites for messages.

If given mail folders as input, all messages within in the mail folders will be decoded. All message parts are written to files. If a filename is specified for a message part, that filename will be used when writing the part to a file. If no filename is specified in the message, a unique name will be used based upon the content-type of the message part.

A single message can be decoded by using the `-single` option.

Only MHonArc options that affect parsing of mail folders are applicable for mha-decode. The following options are applicable: `-conlen`, `-mhpattern`, `-msgsep`, `-noconlen`, `-outdir`, `-perlinc`, `-rcfile`, `-single`, `-umask`.

### Additional Options

mha-decode supports the additional command-line options:

`-dcd-digest`
  Do not parse message/rfc822 and message/news attachments. Normally, mha-decode will recursively parse message attachments and decode any parts contained within. With this option, any message attachment encountered will be saved intact.

### Examples

Basic usage:

        shell> mha-decode inbox

Use `-outdir` to have all decoded data placed into a separate directory:

        shell> mha-decode -outdir /var/tmp inbox

And to decode a single message:

        shell> mha-decode -single msg.822

or from standard input:

        shell> some_program | mha-decode -single

Save out attached messages and then pass them into MHonArc to be added to a archive:

        shell> mha-decode -dcd-digest -single digest
        shell> mhonarc -outdir /path/to/archive -mhpattern '^822.*\.822$' .

Note: There is a trailing dot, '`.`', at the end of the called to mhonarc to tell mhonarc to process the current working directory.

Note: You may need to reset the MHPATTERN resource if normal input into the archive is from MH-style mail folders.