diff --git a/doc/management.txt b/doc/management.txt index 974a938ed..a836bd8c3 100644 --- a/doc/management.txt +++ b/doc/management.txt @@ -3359,6 +3359,17 @@ show trace [] "-" otherwise. All these events are independent and an event might trigger a start without being reported and conversely. +show version + Show the version of the current HAProxy process. This is available from + master and workers CLI. + Example: + + $ echo "show version" | socat /var/run/haproxy.sock stdio + 2.4.9 + + $ echo "show version" | socat /var/run/haproxy-master.sock stdio + 2.5.0 + shutdown frontend Completely delete the specified frontend. All the ports it was bound to will be released. It will not be possible to enable the frontend anymore after diff --git a/src/cli.c b/src/cli.c index 1ed0b6dc8..34f781243 100644 --- a/src/cli.c +++ b/src/cli.c @@ -1756,6 +1756,14 @@ static int cli_parse_expert_experimental_mode(char **args, char *payload, struct return 1; } +/* shows HAProxy version */ +static int cli_parse_show_version(char **args, char *payload, struct appctx *appctx, void *private) +{ + char *msg = NULL; + + return cli_dynmsg(appctx, LOG_INFO, memprintf(&msg, "%s\n", haproxy_version)); +} + int cli_parse_default(char **args, char *payload, struct appctx *appctx, void *private) { return 0; @@ -2980,6 +2988,7 @@ static struct cli_kw_list cli_kws = {{ },{ { { "show", "cli", "level", NULL }, "show cli level : display the level of the current CLI session", cli_parse_show_lvl, NULL, NULL, NULL, ACCESS_MASTER}, { { "show", "fd", NULL }, "show fd [num] : dump list of file descriptors in use or a specific one", cli_parse_show_fd, cli_io_handler_show_fd, NULL }, { { "show", "activity", NULL }, "show activity : show per-thread activity stats (for support/developers)", cli_parse_default, cli_io_handler_show_activity, NULL }, + { { "show", "version", NULL }, "show version : show version of the current process", cli_parse_show_version, NULL, NULL, NULL, ACCESS_MASTER }, { { "operator", NULL }, "operator : lower the level of the current CLI session to operator", cli_parse_set_lvl, NULL, NULL, NULL, ACCESS_MASTER}, { { "user", NULL }, "user : lower the level of the current CLI session to user", cli_parse_set_lvl, NULL, NULL, NULL, ACCESS_MASTER}, {{},}