脚本优化
This commit is contained in:
parent
2af1f91199
commit
35defa1ab7
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 18581
|
port: 28581
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
@ -9,7 +9,7 @@ spring:
|
||||||
name: bonus-auth
|
name: bonus-auth
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: sgzb_bns_test
|
active: material_mall_test
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
username: nacos
|
username: nacos
|
||||||
|
|
@ -17,11 +17,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
suffix="-material"
|
suffix="-material-mall"
|
||||||
jar_version="24.11.0-SNAPSHOT"
|
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 app_workspace=/opt/builds/releases/Bonus-Cloud/${jar_version}
|
||||||
export biz_workspace=/opt/install/jenkins_home/workspace/Bonus-Cloud-Material
|
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'"
|
echo "copied ${app_workspace}/${source_jar} to '$deploy_path/$new_filename'"
|
||||||
done
|
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"
|
echo "copied ${app_workspace}/${source_jar} to $deploy_path"
|
||||||
|
|
||||||
# Define an array of JAR files to run
|
# Define an array of JAR files to run
|
||||||
jars=("bonus-auth-${jar_version}-material.jar --spring.config.location=file:auth_bootstrap.yml"
|
jars=("bonus-auth-${jar_version}-material-mall.jar --spring.config.location=file:auth_bootstrap.yml"
|
||||||
"bonus-gateway-${jar_version}-material.jar --spring.config.location=file:gateway_bootstrap.yml"
|
"bonus-gateway-${jar_version}-material-mall.jar --spring.config.location=file:gateway_bootstrap.yml"
|
||||||
"bonus-system-${jar_version}-material.jar --spring.config.location=file:system_bootstrap.yml"
|
"bonus-system-${jar_version}-material-mall.jar --spring.config.location=file:system_bootstrap.yml"
|
||||||
"bonus-job-${jar_version}-material.jar --spring.config.location=file:job_bootstrap.yml"
|
"bonus-job-${jar_version}-material-mall.jar --spring.config.location=file:job_bootstrap.yml"
|
||||||
"bonus-file-${jar_version}-material.jar --spring.config.location=file:file_bootstrap.yml"
|
"bonus-file-${jar_version}-material-mall.jar --spring.config.location=file:file_bootstrap.yml"
|
||||||
"bonus-visual-monitor-${jar_version}-material.jar --spring.config.location=file:visual_bootstrap.yml"
|
"bonus-visual-monitor-${jar_version}-material-mall.jar --spring.config.location=file:visual_bootstrap.yml"
|
||||||
"bonus-material.jar --spring.config.location=file:material_bootstrap.yml")
|
"bonus-material-mall.jar --spring.config.location=file:material_mall_bootstrap.yml")
|
||||||
|
|
||||||
# 遍历数组并检查每个JAR文件的进程
|
# 遍历数组并检查每个JAR文件的进程
|
||||||
for jar_with_args in "${jars[@]}"; do
|
for jar_with_args in "${jars[@]}"; do
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -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."
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 18583
|
port: 28583
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
@ -9,7 +9,7 @@ spring:
|
||||||
name: bonus-file
|
name: bonus-file
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: sgzb_bns_test
|
active: material_mall_test
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
username: nacos
|
username: nacos
|
||||||
|
|
@ -17,11 +17,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 18580
|
port: 28580
|
||||||
servlet:
|
servlet:
|
||||||
context-path: zhgd
|
context-path: zhgd
|
||||||
# Spring
|
# Spring
|
||||||
|
|
@ -10,7 +10,7 @@ spring:
|
||||||
name: bonus-gateway
|
name: bonus-gateway
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: sgzb_bns_test
|
active: material_mall_test
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
username: nacos
|
username: nacos
|
||||||
|
|
@ -18,11 +18,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
@ -33,7 +33,7 @@ spring:
|
||||||
eager: true
|
eager: true
|
||||||
transport:
|
transport:
|
||||||
# 控制台地址
|
# 控制台地址
|
||||||
dashboard: 192.168.0.14:18858
|
dashboard: 192.168.0.14:28858
|
||||||
# nacos配置持久化
|
# nacos配置持久化
|
||||||
datasource:
|
datasource:
|
||||||
ds1:
|
ds1:
|
||||||
|
|
@ -41,7 +41,7 @@ spring:
|
||||||
username: nacos
|
username: nacos
|
||||||
password: bonus@Admin123
|
password: bonus@Admin123
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
dataId: sentinel-bonus-gateway
|
dataId: sentinel-bonus-gateway
|
||||||
groupId: DEFAULT_GROUP
|
groupId: DEFAULT_GROUP
|
||||||
data-type: json
|
data-type: json
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 18584
|
port: 28584
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
@ -9,7 +9,7 @@ spring:
|
||||||
name: bonus-gen
|
name: bonus-gen
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: sgzb_bns_test
|
active: material_mall_test
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
username: nacos
|
username: nacos
|
||||||
|
|
@ -17,11 +17,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 18585
|
port: 28585
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
@ -9,7 +9,7 @@ spring:
|
||||||
name: bonus-job
|
name: bonus-job
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: sgzb_bns_test
|
active: material_mall_test
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
username: nacos
|
username: nacos
|
||||||
|
|
@ -17,11 +17,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
AUTH_RESOURCE_NAME=bonus-auth-24.11.0-SNAPSHOT-material.jar
|
AUTH_RESOURCE_NAME=bonus-auth-24.10.0-SNAPSHOT-material-mall.jar
|
||||||
GATEWAY_RESOURCE_NAME=bonus-gateway-24.11.0-SNAPSHOT-material.jar
|
GATEWAY_RESOURCE_NAME=bonus-gateway-24.10.0-SNAPSHOT-material-mall.jar
|
||||||
SYS_RESOURCE_NAME=bonus-system-24.11.0-SNAPSHOT-material.jar
|
SYS_RESOURCE_NAME=bonus-system-24.10.0-SNAPSHOT-material-mall.jar
|
||||||
JOB_RESOURCE_NAME=bonus-job-24.11.0-SNAPSHOT-material.jar
|
JOB_RESOURCE_NAME=bonus-job-24.10.0-SNAPSHOT-material-mall.jar
|
||||||
FILE_RESOURCE_NAME=bonus-file-24.11.0-SNAPSHOT-material.jar
|
FILE_RESOURCE_NAME=bonus-file-24.10.0-SNAPSHOT-material-mall.jar
|
||||||
MONITOR_RESOURCE_NAME=bonus-visual-monitor-24.11.0-SNAPSHOT-material.jar
|
MONITOR_RESOURCE_NAME=bonus-visual-monitor-24.10.0-SNAPSHOT-material-mall.jar
|
||||||
MATERIAL_RESOURCE_NAME=bonus-material.jar
|
MATERIAL_RESOURCE_NAME=bonus-material-mall.jar
|
||||||
|
|
||||||
|
|
||||||
tpid=`ps -ef|grep $AUTH_RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
|
tpid=`ps -ef|grep $AUTH_RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
|
||||||
|
|
|
||||||
|
|
@ -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}
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 18582
|
port: 28582
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
@ -9,7 +9,7 @@ spring:
|
||||||
name: bonus-system
|
name: bonus-system
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: sgzb_bns_test
|
active: material_mall_test
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
username: nacos
|
username: nacos
|
||||||
|
|
@ -17,11 +17,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 18586
|
port: 28586
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
@ -9,7 +9,7 @@ spring:
|
||||||
name: bonus-monitor
|
name: bonus-monitor
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: sgzb_bns_test
|
active: material_mall_test
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
username: nacos
|
username: nacos
|
||||||
|
|
@ -17,11 +17,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 192.168.0.244:8848
|
server-addr: 192.168.0.244:8848
|
||||||
namespace: sgzb_bns
|
namespace: material_mall
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue