LinuxCommandLibrary

qm-stop

Stop a virtual machine or container

TLDR

Stop a virtual machine immediately

$ qm stop [VM_ID]
copy

Stop a virtual machine and wait for at most 10 seconds
$ qm stop --timeout [10] [VM_ID]
copy

Stop a virtual machine and skip lock (only root can use this option)
$ qm stop --skiplock [true] [VM_ID]
copy

Stop a virtual machine and don't deactivate storage volumes
$ qm stop --keepActive [true] [VM_ID]
copy

SYNOPSIS

qm-stop

PARAMETERS

(None)
    The qm-stop command does not accept any command-line options or parameters. Its behavior is entirely dependent on the configuration of the Qmail installation and the process supervision system (e.g., daemontools or runit) it interacts with.

DESCRIPTION

qm-stop is a utility used to gracefully halt the Qmail mail transfer agent (MTA) daemon and its associated services. When executed, it sends appropriate signals to the running Qmail processes (such as qmail-send, qmail-lspawn, qmail-rspawn, qmail-smtpd, etc.) to ensure a clean shutdown.

This means that current mail deliveries might complete, and no new mail processing or acceptance will occur until Qmail is restarted. It's a crucial part of managing a Qmail installation, often used before system maintenance, configuration changes, or during troubleshooting to prevent mail loop issues or resource consumption. It relies on the correct setup of Qmail's process supervision mechanisms, commonly handled by daemontools or runit, which ensures that services are stopped in an orderly fashion. It does not directly manage the mail queue; rather, it stops the processes responsible for sending and receiving mail and processing the queue.

CAVEATS

  • Prerequisites: This command assumes a functional Qmail installation, typically managed by a process supervision system like daemontools or runit. Without this setup, qm-stop may not function correctly or might not be present.
  • Permissions: It must be run with appropriate permissions, typically as the root user or a user with privileges to control the Qmail service and its associated processes.
  • Queue Management: While qm-stop halts the Qmail processes, it does not clear or directly manage the mail queue. Any mail waiting in the queue will remain there until Qmail is restarted.
  • Supervisor Dependency: Its operation relies on the Qmail services being correctly managed by a supervisor. If Qmail is not running under such a system, qm-stop might fail or report that Qmail is not running.

USAGE CONTEXT

qm-stop is typically employed in scenarios requiring a controlled shutdown of the mail system. This includes performing system maintenance (e.g., kernel upgrades, hardware changes), applying Qmail configuration updates, or during troubleshooting to isolate issues by stopping mail flow. It is almost always followed by qm-start after the necessary operations are completed.

HISTORY

qm-stop is an integral part of the Qmail suite, a Mail Transfer Agent (MTA) developed by Daniel J. Bernstein (DJB) in the mid-1990s. Qmail was designed with a strong emphasis on security, reliability, and modularity. This modular design often necessitates the use of external process supervision tools like daemontools to manage its various components.

The qm-stop command emerged as a standard administrative tool within the Qmail ecosystem, providing a consistent and reliable method for administrators to gracefully shut down the mail system. Its usage has remained consistent since the early days of Qmail, reflecting the stable and robust nature of the Qmail architecture and its interaction with process supervisors.

SEE ALSO

qm-start(8), qm-qread(8), qmail-send(8), qmail-smtpd(8), supervise(8), svc(8)

Copied to clipboard