add master version control by web service from master_ctld

This commit is contained in:
zsx 2018-02-27 11:24:15 +08:00
parent 93a50ea074
commit a6515afd23
5 changed files with 15 additions and 10 deletions

View File

@ -103,8 +103,8 @@ int main(int argc, char **argv)
acl_msg_verbose++;
break;
case 'v':
printf("%s (acl_master, acl-%s)\r\n",
MASTER_VERSION, acl_version());
printf("%s %s %s(acl-%s)\r\n", MASTER_NAME,
MASTER_VERSION, MASTER_DATE, acl_version());
return 0;
case 'h':
usage(argv[0]);

View File

@ -13,6 +13,8 @@
#ifndef __MASTER_VERSION_INCLUDE_H__
#define __MASTER_VERSION_INCLUDE_H__
#define MASTER_VERSION "3.3.0-81 20180227"
#define MASTER_NAME "acl_master"
#define MASTER_VERSION "3.3.0-81"
#define MASTER_DATE "20180227"
#endif

View File

@ -99,10 +99,11 @@ endif
###########################################################
ACL_PATH = ../../../..
JSON_PATH = ../../daemon/json
MASTER_PATH = ../..
MASTER_JSON = $(MASTER_PATH)/daemon/json
CFLAGS += -I. \
-I$(JSON_PATH) \
-I$(MASTER_PATH) \
-I$(ACL_PATH)/lib_acl/include \
-I$(ACL_PATH)/lib_acl_cpp/include \
-I$(ACL_PATH)/lib_protocol/include
@ -120,7 +121,7 @@ $(shell mkdir -p $(OBJ_PATH))
#Project's objs
SRC = $(wildcard *.cpp) \
$(wildcard $(JSON_PATH)/*.cpp) \
$(wildcard $(MASTER_JSON)/*.cpp) \
$(wildcard main/*.cpp) \
$(wildcard action/*.cpp)
OBJ = $(patsubst %.cpp, $(OBJ_PATH)/%.o, $(notdir $(SRC)))
@ -131,7 +132,7 @@ $(OBJ_PATH)/%.o: main/%.cpp
$(COMPILE) $< -o $@
$(OBJ_PATH)/%.o: action/%.cpp
$(COMPILE) $< -o $@
$(OBJ_PATH)/%.o: $(JSON_PATH)/%.cpp
$(OBJ_PATH)/%.o: $(MASTER_JSON)/%.cpp
$(COMPILE) $< -o $@
.PHONY = all clean

View File

@ -1,4 +1,5 @@
#include "stdafx.h"
#include "daemon/version.h"
#include "action/action.h"
#include "http_servlet.h"
@ -79,7 +80,8 @@ bool http_servlet::doGet(acl::HttpServletRequest& req,
res.setContentType("text/plain")
.setKeepAlive(req.isKeepAlive());
acl::string body("ok\r\n");
acl::string body;
body.format("%s version: %s\r\n", MASTER_NAME, MASTER_VERSION);
return reply(req, res, 200, body);
}

View File

@ -18,8 +18,8 @@
#endif
#include <set>
#include "struct.h"
#include "serialize.h"
#include "daemon/json/struct.h"
#include "daemon/json/serialize.h"
extern char *var_cfg_manage_addr;
extern int var_cfg_save_all;