Add show version command to maxadmin

After upgrades, it is usually useful to see which version of MaxScale is
running. By adding a command, we can see the actual version of the running
daemon process instead of the version of the current binary.
This commit is contained in:
Markus Mäkelä
2016-12-19 17:06:31 +02:00
parent 28f828b8a7
commit aae84144ea

View File

@ -46,7 +46,7 @@
*
* @endverbatim
*/
#include <my_config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -74,7 +74,7 @@
#include <maxscale/listmanager.h>
#include <maxscale/maxscale.h>
#include <maxscale/config_runtime.h>
#include <maxscale/version.h>
#include <maxscale/log_manager.h>
#include <sys/syslog.h>
@ -113,6 +113,11 @@ struct subcommand
static void telnetdShowUsers(DCB *);
static void show_log_throttling(DCB *);
static void showVersion(DCB *dcb)
{
dcb_printf(dcb, "%s\n", MAXSCALE_VERSION);
}
/**
* The subcommands of the show command
*/
@ -283,6 +288,12 @@ struct subcommand showoptions[] =
"Show all maxadmin enabled Linux accounts and created maxadmin users",
{0, 0, 0}
},
{
"version", 0, 0, showVersion,
"Show MaxScale version",
"Show the MaxScale version number",
{0, 0, 0}
},
{ EMPTY_OPTION}
};