---
name: "hapc"
section: "1"
platform: "linux"
package: "haproxy-cmd"
version: "0.0.7"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/hapc"
---

# hapc(1)

administrative commands for your haproxy service

## NAME

hapc - administrative commands for your haproxy service

## SYNOPSIS

**hapc** **\<action\> \[options\] \[arguments\]**

## DESCRIPTION

*hapc* configures the backends of an haproxy setup, so it is possible to put backend servers in maintenance gracefully.

## OPTIONS

*-verbose\|-v*

-

  Display with a more verbose output.

## ACTIONS

**list-backends** *\[-l\|--links\]*

-

  List all available backends, asking through the haproxy socket file.

**list-frontends**

-

  List all available frontend as configured in the haproxy.cfg file.

**list-config-backends**

-

  List all available backends as configured in the haproxy.cfg file.

**list-servers** *\[-b\|--backend\] \<backend\>* *\[-d\|--details\]*

-

  List all available servers for a given backend. With --details, the command shows the state of the servers (if they are active in the backend or not).

**list-connections** *\[-b\|--backend\] \<backend\>* *\[-s\|--server\] \<server\>*

-

  Show the number of connections for a given backend and server.

**enable-server** *\[-b\|--backend\] \<backend\>* *\[-s\|--server\] \<server\>*

-

  Set a server as ACTIVE in its backend.

**drain-server** *\[-b\|--backend\] \<backend\>* *\[-s\|--server\] \<server\>* *\[-w\|--wait\]*

-

  Gracefuly drain a server from its backend. If the --wait option is added, then hapc waits for all connections to be closed before returning, with a timeout set to 60 seconds.

**stop-server** *\[-b\|--backend\] \<backend\>* *\[-s\|--server\] \<server\>*

-

  Forceably remove a server from its backend, eventually killing existing connections.

**check-safe-to-remove** *\[-b\|--backend\] \<backend\>* *\[-s\|--server\] \<server\>*

-

  Check if a server is safe to remove from its backend (ie: check if there's not existing connections to it).

**reload-haproxy**

-

  Reload haproxy.

## DESCRIPTION

*hapc* needs an admin socket to be able to use it. So it is needed to add this to /etc/haproxy/haproxy.cfg:

global\
         stats socket /var/lib/haproxy/admin.sock mode 600 level admin

## LICENSE

-

  This is released under the Apache-2.0 license.

## AUTHORS

-

  This utility has been written by Olivier Chaze \<olivier.chaze at infomaniak dot com\> and Thomas Goirand \<zigo at debian dot org\> for internal use in the Infomaniak servers.
