!42 [sync] PR-40: Fix systemctl startup service problem

From: @openeuler-sync-bot 
Reviewed-by: @zhu-yuncheng 
Signed-off-by: @zhu-yuncheng
This commit is contained in:
openeuler-ci-bot 2023-09-19 12:31:46 +00:00 committed by Gitee
commit cee0adb9f1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 63 additions and 1 deletions

View File

@ -0,0 +1,58 @@
From 97d9a39ac7a196af73f491f3d447023797fbe469 Mon Sep 17 00:00:00 2001
From: gongzt <gong_zhengtang@163.com>
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

View File

@ -1,11 +1,12 @@
Name: aops-vulcanus Name: aops-vulcanus
Version: v1.3.0 Version: v1.3.0
Release: 2 Release: 3
Summary: A basic tool libraries of aops, including logging, configure and response, etc. Summary: A basic tool libraries of aops, including logging, configure and response, etc.
License: MulanPSL2 License: MulanPSL2
URL: https://gitee.com/openeuler/%{name} URL: https://gitee.com/openeuler/%{name}
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
Patch0001: 0001-optimize-service-start-check-logic.patch Patch0001: 0001-optimize-service-start-check-logic.patch
Patch0002: 0002-fix-systemctl-startup-service-error.patch
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
@ -61,6 +62,9 @@ cp -r scripts %{buildroot}/opt/aops/
%changelog %changelog
* Tue Sep 19 2023 wenxin<shusheng.wen@outlook.com> - v1.3.0-3
- fix systemctl startup service problem
* Mon Sep 11 2023 zhuyuncheng<zhuyuncheng@huawei.com> - v1.3.0-2 * Mon Sep 11 2023 zhuyuncheng<zhuyuncheng@huawei.com> - v1.3.0-2
- optimize start service check logic - optimize start service check logic