MINOR: cli: implements 'reload' on master CLI
The reload command reload the haproxy master like it is done with a kill
-USR2 on the master process.
diff --git a/src/cli.c b/src/cli.c
index 1a2253c..23caac3 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -1318,6 +1318,17 @@
return 1;
}
+/* reload the master process */
+static int cli_parse_reload(char **args, char *payload, struct appctx *appctx, void *private)
+{
+ if (!cli_has_level(appctx, ACCESS_LVL_OPER))
+ return 1;
+
+ mworker_reload();
+
+ return 1;
+}
+
int cli_parse_default(char **args, char *payload, struct appctx *appctx, void *private)
{
return 0;
@@ -2619,6 +2630,7 @@
{ { "show", "proc", NULL }, "show proc : show processes status", cli_parse_default, cli_io_handler_show_proc, NULL, NULL, ACCESS_MASTER_ONLY},
{ { "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},
+ { { "reload", NULL }, "reload : reload haproxy", cli_parse_reload, NULL, NULL, NULL, ACCESS_MASTER_ONLY},
{ { "_getsocks", NULL }, NULL, _getsocks, NULL },
{{},}
}};
diff --git a/src/haproxy.c b/src/haproxy.c
index 20fc1de..994e39c 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -708,7 +708,7 @@
* When called, this function reexec haproxy with -sf followed by current
* children PIDs and possibly old children PIDs if they didn't leave yet.
*/
-static void mworker_reload()
+void mworker_reload()
{
int next_argc = 0;
int j;