SCE输出版本号

This commit is contained in:
luwenpeng
2023-03-07 10:28:22 +08:00
parent 83e4eba61f
commit 75c2ba842f
2 changed files with 34 additions and 4 deletions

View File

@@ -11,6 +11,20 @@
#include "health_check.h"
#include "global_metrics.h"
#ifdef SCE_GIT_VERSION
static __attribute__((__used__)) const char *__sce_version = SCE_GIT_VERSION;
#else
static __attribute__((__used__)) const char *__sce_version = "Unknown";
#endif
static void usage(char *cmd)
{
fprintf(stderr, "USAGE: %s [OPTIONS]\n", cmd);
fprintf(stderr, " -v -- show version\n");
fprintf(stderr, " -h -- show help info\n\n");
fprintf(stderr, "kill -s SIGHUP $PID -- reload zlog configure\n");
}
static void sig_handler(int signo)
{
if (signo == SIGHUP)
@@ -90,6 +104,22 @@ int main(int argc, char **argv)
{
const char *profile = "./conf/sce.conf";
int opt = 0;
while ((opt = getopt(argc, argv, "vh")) != -1)
{
switch (opt)
{
case 'v':
fprintf(stderr, "TSG Service Chaining Engine, Version: %s\n", __sce_version);
return 0;
case 'h': /* fall through */
default:
usage(argv[0]);
return 0;
}
}
fprintf(stderr, "TSG Service Chaining Engine, Version: %s\n", __sce_version);
if (LOG_INIT("./conf/zlog.conf") == -1)
{
return -1;