From 8ba0cc1eb6ae6a5af8d95243bfd53c644d85b6dc Mon Sep 17 00:00:00 2001 From: rabbitali Date: Tue, 19 Sep 2023 10:41:10 +0800 Subject: [PATCH] Fix systemctl startup service problem (cherry picked from commit 0e28be3eea90f71e6340c4e8e658c8a189ae1923) --- ...-fix-systemctl-startup-service-error.patch | 58 +++++++++++++++++++ aops-vulcanus.spec | 6 +- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 0002-fix-systemctl-startup-service-error.patch diff --git a/0002-fix-systemctl-startup-service-error.patch b/0002-fix-systemctl-startup-service-error.patch new file mode 100644 index 0000000..595f38b --- /dev/null +++ b/0002-fix-systemctl-startup-service-error.patch @@ -0,0 +1,58 @@ +From 97d9a39ac7a196af73f491f3d447023797fbe469 Mon Sep 17 00:00:00 2001 +From: gongzt +Date: Mon, 18 Sep 2023 11:39:40 +0800 +Subject: [PATCH 1/1] fix systemctl startup service error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + aops-vulcanus | 5 ++++- + scripts/deploy/aops-basedatabase.sh | 6 +++--- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/aops-vulcanus b/aops-vulcanus +index ba854f9..f00b4a0 100644 +--- a/aops-vulcanus ++++ b/aops-vulcanus +@@ -101,9 +101,11 @@ function start_service() { + module_name=$1 + echo "[INFO] 1. Before starting the service, ensure that the data table is initialized" + echo "[INFO] 2. Execute aops-basedatabase zeus or apollo to complete the data table initialization, For example '/opt/aops/script/aops-basedatabase init zeus'" ++ rm -rf ${OUT_PATH}/"${module_name}".pid + uwsgi -d --ini ${OUT_PATH}/"${module_name}".ini --enable-threads + pid=`ps auxww | grep $module_name.ini | grep -v grep | awk '{print $2}'` +- if [ "${pid}" = "" ]; then ++ local_pid=`cat ${OUT_PATH}/"${module_name}".pid` ++ if [ "${pid}" = "" ] && [ "${local_pid}" = "" ]; then + echo "[ERROR] start uwsgi service: ${module_name} failed" + exit 1 + fi +@@ -115,6 +117,7 @@ function stop_service() { + module_name=$1 + echo "[INFO] stop uwsgi service: ${module_name}" + uwsgi --stop ${OUT_PATH}/"${module_name}".pid ++ rm -rf ${OUT_PATH}/"${module_name}".pid + echo "[INFO] stop ${AOPS_CONSTANT} service success" + exit 0 + } +diff --git a/scripts/deploy/aops-basedatabase.sh b/scripts/deploy/aops-basedatabase.sh +index 054bea9..49a80f4 100755 +--- a/scripts/deploy/aops-basedatabase.sh ++++ b/scripts/deploy/aops-basedatabase.sh +@@ -133,9 +133,9 @@ function main(){ + service=$2 + case $operation in + "init") +- if [ "${service}" != "zeus" ] && [ "${service}" != "apollo" ]; then +- echo "[ERROR] Table initialization service can only be zeus or apollo" +- echo "[INFO] e.g 'aops-basedatabase init zeus' or 'aops-basedatabase init apollo'" ++ if [ "${service}" != "zeus" ] && [ "${service}" != "apollo" ] && [ "${service}" != "diana" ]; then ++ echo "[ERROR] Table initialization service can only be zeus apollo or diana" ++ echo "[INFO] e.g 'aops-basedatabase init zeus' 'aops-basedatabase init apollo' or 'aops-basedatabase init diana'" + exit 1 + fi + config_file="/etc/aops/$service.ini" +-- +2.33.1.windows.1 + diff --git a/aops-vulcanus.spec b/aops-vulcanus.spec index 2cc0946..b73fb9d 100644 --- a/aops-vulcanus.spec +++ b/aops-vulcanus.spec @@ -1,11 +1,12 @@ Name: aops-vulcanus Version: v1.3.0 -Release: 2 +Release: 3 Summary: A basic tool libraries of aops, including logging, configure and response, etc. License: MulanPSL2 URL: https://gitee.com/openeuler/%{name} Source0: %{name}-%{version}.tar.gz Patch0001: 0001-optimize-service-start-check-logic.patch +Patch0002: 0002-fix-systemctl-startup-service-error.patch BuildRequires: python3-setuptools @@ -61,6 +62,9 @@ cp -r scripts %{buildroot}/opt/aops/ %changelog +* Tue Sep 19 2023 wenxin - v1.3.0-3 +- fix systemctl startup service problem + * Mon Sep 11 2023 zhuyuncheng - v1.3.0-2 - optimize start service check logic -- Gitee