Add stopping and starting of listeners to maxadmin

Listeners can now be stopped and started individually.
This commit is contained in:
Markus Makela
2016-11-28 16:04:51 +02:00
parent ecdeb009b3
commit 4ff4e69592
3 changed files with 85 additions and 7 deletions

View File

@ -423,6 +423,19 @@ static void shutdown_server()
static void shutdown_service(DCB *dcb, SERVICE *service);
static void shutdown_monitor(DCB *dcb, MONITOR *monitor);
static void
shutdown_listener(DCB *dcb, SERVICE *service, const char *name)
{
if (serviceStopListener(service, name))
{
dcb_printf(dcb, "Stopped listener '%s'\n", name);
}
else
{
dcb_printf(dcb, "Failed to stop listener '%s'\n", name);
}
}
/**
* The subcommands of the shutdown command
*/
@ -452,6 +465,14 @@ struct subcommand shutdownoptions[] =
"E.g. shutdown service \"Sales Database\"",
{ARG_TYPE_SERVICE, 0, 0}
},
{
"listener",
2, 2,
shutdown_listener,
"Stop a listener",
"E.g. shutdown listener \"RW Service\" \"RW Listener\"",
{ARG_TYPE_SERVICE, ARG_TYPE_STRING}
},
{
EMPTY_OPTION
}
@ -487,6 +508,20 @@ struct subcommand syncoptions[] =
static void restart_service(DCB *dcb, SERVICE *service);
static void restart_monitor(DCB *dcb, MONITOR *monitor);
static void
restart_listener(DCB *dcb, SERVICE *service, const char *name)
{
if (serviceStartListener(service, name))
{
dcb_printf(dcb, "Restarted listener '%s'\n", name);
}
else
{
dcb_printf(dcb, "Failed to restart listener '%s'\n", name);
}
}
/**
* The subcommands of the restart command
*/
@ -504,6 +539,12 @@ struct subcommand restartoptions[] =
"E.g. restart service \"Sales Database\"",
{ARG_TYPE_SERVICE, 0, 0}
},
{
"listener", 2, 2, restart_listener,
"Restart a listener",
"E.g. restart listener \"RW Service\" \"RW Listener\"",
{ARG_TYPE_SERVICE, ARG_TYPE_STRING}
},
{ EMPTY_OPTION }
};