aops-vulcanus/0002-fix-systemctl-startup-service-error.patch
rabbitali a95950aaba Fix systemctl startup service problem
(cherry picked from commit 0e28be3eea90f71e6340c4e8e658c8a189ae1923)
2023-09-19 11:22:39 +08:00

59 lines
2.5 KiB
Diff

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