脚本优化

This commit is contained in:
sxu 2024-11-27 11:19:02 +08:00
parent 2af1f91199
commit 35defa1ab7
12 changed files with 85 additions and 127 deletions

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 18581
port: 28581
# Spring
spring:
@ -9,7 +9,7 @@ spring:
name: bonus-auth
profiles:
# 环境配置
active: sgzb_bns_test
active: material_mall_test
cloud:
nacos:
username: nacos
@ -17,11 +17,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
config:
# 配置中心地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -1,8 +1,8 @@
#!/bin/bash
suffix="-material"
jar_version="24.11.0-SNAPSHOT"
suffix="-material-mall"
jar_version="24.10.0-SNAPSHOT"
export deploy_path=/opt/webapps/bonus-material
export deploy_path=/opt/webapps/bonus-material-mall
export app_workspace=/opt/builds/releases/Bonus-Cloud/${jar_version}
export biz_workspace=/opt/install/jenkins_home/workspace/Bonus-Cloud-Material
@ -34,17 +34,17 @@ for source_jar in "${app_source_jars[@]}"; do
echo "copied ${app_workspace}/${source_jar} to '$deploy_path/$new_filename'"
done
cp -f ${biz_workspace}/"bonus-modules/bonus-material/target/bonus-material.jar" $deploy_path
cp -f ${biz_workspace}/"bonus-modules/bonus-material-mall/target/bonus-material-mall.jar" $deploy_path
echo "copied ${app_workspace}/${source_jar} to $deploy_path"
# Define an array of JAR files to run
jars=("bonus-auth-${jar_version}-material.jar --spring.config.location=file:auth_bootstrap.yml"
"bonus-gateway-${jar_version}-material.jar --spring.config.location=file:gateway_bootstrap.yml"
"bonus-system-${jar_version}-material.jar --spring.config.location=file:system_bootstrap.yml"
"bonus-job-${jar_version}-material.jar --spring.config.location=file:job_bootstrap.yml"
"bonus-file-${jar_version}-material.jar --spring.config.location=file:file_bootstrap.yml"
"bonus-visual-monitor-${jar_version}-material.jar --spring.config.location=file:visual_bootstrap.yml"
"bonus-material.jar --spring.config.location=file:material_bootstrap.yml")
jars=("bonus-auth-${jar_version}-material-mall.jar --spring.config.location=file:auth_bootstrap.yml"
"bonus-gateway-${jar_version}-material-mall.jar --spring.config.location=file:gateway_bootstrap.yml"
"bonus-system-${jar_version}-material-mall.jar --spring.config.location=file:system_bootstrap.yml"
"bonus-job-${jar_version}-material-mall.jar --spring.config.location=file:job_bootstrap.yml"
"bonus-file-${jar_version}-material-mall.jar --spring.config.location=file:file_bootstrap.yml"
"bonus-visual-monitor-${jar_version}-material-mall.jar --spring.config.location=file:visual_bootstrap.yml"
"bonus-material-mall.jar --spring.config.location=file:material_mall_bootstrap.yml")
# 遍历数组并检查每个JAR文件的进程
for jar_with_args in "${jars[@]}"; do

View File

@ -1,37 +0,0 @@
#!/bin/sh
export deploy_path=/opt/builds/${JOB_NAME}
echo "--------moveFile start--------------"
rm -rf $deploy_path
mkdir -p $deploy_path
cd $deploy_path
rm -rf *.jar
echo "workspace is ${WORKSPACE}"
mv ${WORKSPACE}/bonus-modules/bonus-material/target/bonus-material.jar $deploy_path
chmod 777 *.jar
echo "--------moveFile end--------------"
export bonus_material_enable=true
export bonus_material_jar=bonus-material.jar
export bonus_material_port=18588
if($bonus_material_enable);then
echo "--------bonus_material 开始启动--------------"
echo "--------删除bonus__material开始--------------"
P_ID=`ps -ef | grep -w $bonus_material_jar | grep -v "grep" | awk '{print $2}'`
if [ "$P_ID" == "" ]; then
echo "===bonus_material process not exists or stop success"
else
kill -9 $P_ID
echo "bonus_material killed success"
fi
echo "--------bonus_material开始部署--------------"
nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar $bonus_material_jar >/dev/null 2>&1 &
bonus_material_pid=`lsof -i:$bonus_material_port|grep "LISTEN"|awk '{print $2}'`
until [ -n "$bonus_material_pid" ]
do
bonus_material_pid=`lsof -i:$bonus_material_port|grep "LISTEN"|awk '{print $2}'`
done
echo "bonus_material pid is $bonus_material_pid"
echo "--------bonus_material 启动成功--------------"
fi

View File

@ -1,40 +0,0 @@
#!/bin/bash
export deploy_path=/opt/webapps/bonus-material
# Define an array of JAR files to run
jars=("bonus-material.jar --spring.config.location=file:material_bootstrap.yml")
# 遍历数组并检查每个JAR文件的进程
for jar_with_args in "${jars[@]}"; do
# 提取JAR文件名不包括参数
jar=$(echo $jar_with_args | awk '{print $1}')
# 检查进程是否启动
echo "原应用程序1 $jar "
pids=$(pgrep -f $jar || true)
echo "原应用程序2 $jar "
if [ -n "$pids" ]; then
echo "$jar is running with PID(s): $pids"
# 杀死进程
for pid in $pids; do
kill -9 $pid
if [ $? -eq 0 ]; then
echo "Process $pid for $jar killed successfully"
else
echo "Failed to kill process $pid for $jar"
fi
done
else
echo "$jar is not running"
fi
done
cd $deploy_path || { echo "Failed to change directory to $deploy_path"; exit 1; }
# Iterate over the JAR files array
for jar in "${jars[@]}"; do
echo "Starting $jar"
nohup /usr/local/jdk1.8.0/bin/java -jar $jar >/dev/null 2>&1 &
done
echo "All JARs have been run successfully."

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 18583
port: 28583
# Spring
spring:
@ -9,7 +9,7 @@ spring:
name: bonus-file
profiles:
# 环境配置
active: sgzb_bns_test
active: material_mall_test
cloud:
nacos:
username: nacos
@ -17,11 +17,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
config:
# 配置中心地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 18580
port: 28580
servlet:
context-path: zhgd
# Spring
@ -10,7 +10,7 @@ spring:
name: bonus-gateway
profiles:
# 环境配置
active: sgzb_bns_test
active: material_mall_test
cloud:
nacos:
username: nacos
@ -18,11 +18,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
config:
# 配置中心地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
# 配置文件格式
file-extension: yml
# 共享配置
@ -33,7 +33,7 @@ spring:
eager: true
transport:
# 控制台地址
dashboard: 192.168.0.14:18858
dashboard: 192.168.0.14:28858
# nacos配置持久化
datasource:
ds1:
@ -41,7 +41,7 @@ spring:
username: nacos
password: bonus@Admin123
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
dataId: sentinel-bonus-gateway
groupId: DEFAULT_GROUP
data-type: json
@ -55,4 +55,4 @@ system:
#加密组件
jasypt:
encryptor:
password: Encrypt
password: Encrypt

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 18584
port: 28584
# Spring
spring:
@ -9,7 +9,7 @@ spring:
name: bonus-gen
profiles:
# 环境配置
active: sgzb_bns_test
active: material_mall_test
cloud:
nacos:
username: nacos
@ -17,11 +17,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
config:
# 配置中心地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 18585
port: 28585
# Spring
spring:
@ -9,7 +9,7 @@ spring:
name: bonus-job
profiles:
# 环境配置
active: sgzb_bns_test
active: material_mall_test
cloud:
nacos:
username: nacos
@ -17,11 +17,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
config:
# 配置中心地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -1,10 +1,10 @@
AUTH_RESOURCE_NAME=bonus-auth-24.11.0-SNAPSHOT-material.jar
GATEWAY_RESOURCE_NAME=bonus-gateway-24.11.0-SNAPSHOT-material.jar
SYS_RESOURCE_NAME=bonus-system-24.11.0-SNAPSHOT-material.jar
JOB_RESOURCE_NAME=bonus-job-24.11.0-SNAPSHOT-material.jar
FILE_RESOURCE_NAME=bonus-file-24.11.0-SNAPSHOT-material.jar
MONITOR_RESOURCE_NAME=bonus-visual-monitor-24.11.0-SNAPSHOT-material.jar
MATERIAL_RESOURCE_NAME=bonus-material.jar
AUTH_RESOURCE_NAME=bonus-auth-24.10.0-SNAPSHOT-material-mall.jar
GATEWAY_RESOURCE_NAME=bonus-gateway-24.10.0-SNAPSHOT-material-mall.jar
SYS_RESOURCE_NAME=bonus-system-24.10.0-SNAPSHOT-material-mall.jar
JOB_RESOURCE_NAME=bonus-job-24.10.0-SNAPSHOT-material-mall.jar
FILE_RESOURCE_NAME=bonus-file-24.10.0-SNAPSHOT-material-mall.jar
MONITOR_RESOURCE_NAME=bonus-visual-monitor-24.10.0-SNAPSHOT-material-mall.jar
MATERIAL_RESOURCE_NAME=bonus-material-mall.jar
tpid=`ps -ef|grep $AUTH_RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`

View File

@ -0,0 +1,35 @@
# Tomcat
server:
port: 28588
# Spring
spring:
servlet:
multipart:
# 文件最大
max-file-size: 20MB
# 设置总上传数据总大小
max-request-size: 20MB
application:
# 应用名称
name: bonus-material-mall
profiles:
# 环境配置
active: material_mall_test
cloud:
nacos:
username: nacos
password: bonus@Admin123
discovery:
# 服务注册地址
server-addr: 192.168.0.244:8848
namespace: material_mall
config:
# 配置中心地址
server-addr: 192.168.0.244:8848
namespace: material_mall
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 18582
port: 28582
# Spring
spring:
@ -9,7 +9,7 @@ spring:
name: bonus-system
profiles:
# 环境配置
active: sgzb_bns_test
active: material_mall_test
cloud:
nacos:
username: nacos
@ -17,11 +17,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
config:
# 配置中心地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
# 配置文件格式
file-extension: yml
# 共享配置
@ -30,4 +30,4 @@ spring:
system:
supports:
phoneLogin: true
emailLogin: true
emailLogin: true

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 18586
port: 28586
# Spring
spring:
@ -9,7 +9,7 @@ spring:
name: bonus-monitor
profiles:
# 环境配置
active: sgzb_bns_test
active: material_mall_test
cloud:
nacos:
username: nacos
@ -17,11 +17,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
config:
# 配置中心地址
server-addr: 192.168.0.244:8848
namespace: sgzb_bns
namespace: material_mall
# 配置文件格式
file-extension: yml
# 共享配置