Addition for shutdown mechanism for the gateway

Addition of stop and restart service

Fix for telnetd in Makefile

Fix for printing the server names in services
This commit is contained in:
Mark Riddoch
2013-06-25 14:00:18 +02:00
parent 72223fd4cf
commit 34fdbdb34d
11 changed files with 167 additions and 16 deletions

View File

@ -80,6 +80,27 @@ struct subcommand showoptions[] = {
{ NULL, 0, NULL, NULL }
};
extern void shutdown_gateway();
static void shutdown_service(DCB *dcb, SERVICE *service);
/**
* The subcommands of the shutdown command
*/
struct subcommand shutdownoptions[] = {
{ "gateway", 0, shutdown_gateway, "Shutdown the gateway" },
{ "service", 1, shutdown_service, "Shutdown a service, e.g. shutdown service 0x4838320" },
{ NULL, 0, NULL, NULL }
};
static void restart_service(DCB *dcb, SERVICE *service);
/**
* The subcommands of the restart command
*/
struct subcommand restartoptions[] = {
{ "service", 1, restart_service, "Restart a service, e.g. restart service 0x4838320" },
{ NULL, 0, NULL, NULL }
};
/**
* The debug command table
*/
@ -88,6 +109,8 @@ static struct {
struct subcommand *options;
} cmds[] = {
{ "show", showoptions },
{ "shutdown", shutdownoptions },
{ "restart", restartoptions },
{ NULL, NULL }
};
@ -230,3 +253,27 @@ char *saveptr, *delim = " \t\r\n";
return 1;
}
/**
* Debug command to stop a service
*
* @param dcb The DCB to print any output to
* @param service The service to shutdown
*/
static void
shutdown_service(DCB *dcb, SERVICE *service)
{
serviceStop(service);
}
/**
* Debug command to restart a stopped service
*
* @param dcb The DCB to print any output to
* @param service The service to restart
*/
static void
restart_service(DCB *dcb, SERVICE *service)
{
serviceRestart(service);
}