<a id="command-line-interface"></a>

# Command line interface

There are three primary ways of managing hosts (or clusters of);
the [web administration](web.html.md), API ([Protocol Buffer](https://docs.halon.io/protobuf-schemas/6.12-stable/)) or CLI.
The `smtpd` package comes with a program called `halonctl` that
can be used to manage any aspect of the MTA. This section is a guide for
that program.

Every command have a `--help` flag to display available options.

The *halonctl* program communicates with the `smtpd`
processes over [control sockets](api_control_sockets.html.md) as
described by the [Protocol Buffer](https://docs.halon.io/protobuf-schemas/6.12-stable/) schemas.
The raw response data can be useful
when using the CLI for scripting with tools like *jq*,
and the request data can be useful when learning about the API.
Therefore, the commands have a `--json` output flag making it return the raw response
and a  `--json-request` flag that prints the raw request (JSON encoded).

* [Queue management](cli_queue.html.md)
  * [List messages](cli_queue.html.md#list-messages)
  * [Export messages](cli_queue.html.md#export-messages)
  * [Take actions on messages](cli_queue.html.md#take-actions-on-messages)
    * [Actions and working states](cli_queue.html.md#actions-and-working-states)
  * [Show messages distribution](cli_queue.html.md#show-messages-distribution)
  * [Show message structure in queue](cli_queue.html.md#show-message-structure-in-queue)
  * [Active queue policies](cli_queue.html.md#active-queue-policies)
  * [Active queue suspensions](cli_queue.html.md#active-queue-suspensions)
  * [Active queue delivery settings](cli_queue.html.md#active-queue-delivery-settings)
  * [Moving the queue files with *hqfmove*](cli_queue.html.md#moving-the-queue-files-with-hqfmove)
  * [Trace messages](cli_queue.html.md#trace-messages)
  * [Loading queue files](cli_queue.html.md#loading-queue-files)
* [Configuration management](cli_config.html.md)
  * [Script syntax and packing](cli_config.html.md#script-syntax-and-packing)
  * [Reloading configurations](cli_config.html.md#reloading-configurations)
  * [Blue-green testing](cli_config.html.md#blue-green-testing)
  * [Remote configuration](cli_config.html.md#remote-configuration)
* [Script engine](cli_script.html.md)
  * [Shared memory functions](cli_script.html.md#shared-memory-functions)
  * [Cache statement](cli_script.html.md#cache-statement)
* [DNS resolver](cli_dns.html.md)
* [Statistics and information](cli_stats.html.md)
  * [halontop](cli_stats.html.md#halontop)
  * [halonctl process-stats](cli_stats.html.md#halonctl-process-stats)
* [Metrics summary](openmetrics.html.md)
* [Script interpreter](cli_hsh.html.md)
  * [Options](cli_hsh.html.md#options)
  * [Script interpreter](cli_hsh.html.md#id1)
  * [Interactive shell](cli_hsh.html.md#interactive-shell)
