diff --git a/capability/src/main/resources/bin/100/log.sh b/capability/src/main/resources/bin/100/log.sh new file mode 100644 index 00000000..74b49935 --- /dev/null +++ b/capability/src/main/resources/bin/100/log.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Spring Boot 项目日志查看脚本 +LOG_HOME="/home/app/capability/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# 查看实时日志 +if [ ! -f "${LOG_FILE}" ]; then + echo "日志文件不存在:${LOG_FILE}(可能项目未启动)" + exit 1 +fi +echo "正在查看实时运行日志(按 Ctrl+C 退出)... 日志路径:${LOG_FILE}" +tail -f "${LOG_FILE}" diff --git a/capability/src/main/resources/bin/100/restart.sh b/capability/src/main/resources/bin/100/restart.sh new file mode 100644 index 00000000..5cfa6ae2 --- /dev/null +++ b/capability/src/main/resources/bin/100/restart.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Spring Boot 项目重启脚本 + +# 定义基础路径(公共参数) +BASE_DIR="/home/app/capability" + +echo "=== 开始重启项目 ===" + +# 先停止服务 +if [ -f "${BASE_DIR}/stop.sh" ]; then + "${BASE_DIR}/stop.sh" +else + echo "错误:未找到停止脚本 ${BASE_DIR}/stop.sh" + exit 1 +fi + +# 再启动服务 +if [ -f "${BASE_DIR}/start.sh" ]; then + "${BASE_DIR}/start.sh" +else + echo "错误:未找到启动脚本 ${BASE_DIR}/start.sh" + exit 1 +fi + +echo "=== 重启操作完成 ===" \ No newline at end of file diff --git a/capability/src/main/resources/bin/100/start.sh b/capability/src/main/resources/bin/100/start.sh new file mode 100644 index 00000000..976b8430 --- /dev/null +++ b/capability/src/main/resources/bin/100/start.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Spring Boot 项目启动脚本 +JAR_PATH="/home/app/capability" +JAR_NAME="capability-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/capability/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + +# 检查Jar包是否存在 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +# 获取运行中的进程PID +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 启动服务 +check_jar_exists + +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + +echo "正在启动项目..." + +# 启动项目,保留控制台输出 +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-100 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5001 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & + + + + diff --git a/capability/src/main/resources/bin/100/startprod.sh b/capability/src/main/resources/bin/100/startprod.sh new file mode 100644 index 00000000..ac7a1a40 --- /dev/null +++ b/capability/src/main/resources/bin/100/startprod.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Spring Boot 项目启动脚本 +JAR_PATH="/home/app/capability" +JAR_NAME="capability-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/capability/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + +# 检查Jar包是否存在 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +# 获取运行中的进程PID +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 启动服务 +check_jar_exists + +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + +echo "正在启动项目..." + +# 启动项目,保留控制台输出 +nohup java ${JVM_OPTS} -Dspring.profiles.active=prod -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5001 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & + + + + diff --git a/capability/src/main/resources/bin/100/status.sh b/capability/src/main/resources/bin/100/status.sh new file mode 100644 index 00000000..b045d50e --- /dev/null +++ b/capability/src/main/resources/bin/100/status.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Spring Boot 项目状态查看脚本 +JAR_NAME="capability-0.0.1-SNAPSHOT.jar" +LOG_HOME="/home/app/capability/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# 获取运行中的进程PID +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + + PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目运行中!PID: ${PID}" + echo "日志文件路径:${LOG_FILE}" +else + echo "项目未在运行中" +fi diff --git a/capability/src/main/resources/bin/100/stop.sh b/capability/src/main/resources/bin/100/stop.sh new file mode 100644 index 00000000..b058a183 --- /dev/null +++ b/capability/src/main/resources/bin/100/stop.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Spring Boot 项目停止脚本 +JAR_NAME="capability-0.0.1-SNAPSHOT.jar" + +# 获取运行中的进程PID +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 停止服务 + PID=$(get_running_pid) +if [ -z "${PID}" ]; then + echo "项目未在运行中,无需停止" + exit 0 +fi + +echo "正在停止项目... PID: ${PID}" +kill -15 "${PID}" + + WAIT=0 +while [ ${WAIT} -lt 10 ]; do + if [ -z "$(get_running_pid)" ]; then + echo "项目已优雅停止" + exit 0 + fi + sleep 1 + WAIT=$((WAIT + 1)) +done + +echo "优雅停止超时,强制终止进程... PID: ${PID}" +kill -9 "${PID}" + +sleep 2 +if [ -z "$(get_running_pid)" ]; then + echo "项目已强制停止" +else + echo "ERROR: 进程终止失败!请手动检查:ps -ef | grep ${JAR_NAME}" + exit 1 +fi diff --git a/data/src/main/resources/bin/100/log.sh b/data/src/main/resources/bin/100/log.sh new file mode 100644 index 00000000..2dc63d51 --- /dev/null +++ b/data/src/main/resources/bin/100/log.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Spring Boot 项目日志查看脚本 +LOG_HOME="/home/app/data/logs" +LOG_FILE="${LOG_HOME}/running.log" + + +# 查看实时日志 +if [ ! -f "${LOG_FILE}" ]; then + echo "日志文件不存在:${LOG_FILE}(可能项目未启动)" + exit 1 +fi +echo "正在查看实时运行日志(按 Ctrl+C 退出)... 日志路径:${LOG_FILE}" +tail -f "${LOG_FILE}" diff --git a/data/src/main/resources/bin/100/restart.sh b/data/src/main/resources/bin/100/restart.sh new file mode 100644 index 00000000..daed40e3 --- /dev/null +++ b/data/src/main/resources/bin/100/restart.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Spring Boot 项目重启脚本 + +# 定义基础路径(公共参数) +BASE_DIR="/home/app/data" + +echo "=== 开始重启项目 ===" + +# 先停止服务 +if [ -f "${BASE_DIR}/stop.sh" ]; then + "${BASE_DIR}/stop.sh" +else + echo "错误:未找到停止脚本 ${BASE_DIR}/stop.sh" + exit 1 +fi + +# 再启动服务 +if [ -f "${BASE_DIR}/start.sh" ]; then + "${BASE_DIR}/start.sh" +else + echo "错误:未找到启动脚本 ${BASE_DIR}/start.sh" + exit 1 +fi + +echo "=== 重启操作完成 ===" \ No newline at end of file diff --git a/data/src/main/resources/bin/100/start.sh b/data/src/main/resources/bin/100/start.sh new file mode 100644 index 00000000..5a0e31a7 --- /dev/null +++ b/data/src/main/resources/bin/100/start.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Spring Boot 项目启动脚本 +JAR_PATH="/home/app/data" +JAR_NAME="data-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/data/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + +# 函数定义 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 检查是否已运行 +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 检查Jar包是否存在 +check_jar_exists + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + + +# 启动项目 +echo "正在启动项目..." +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-100 -DXXL_JOB_EXECUTOR_IP=192.168.190.100 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5002 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & \ No newline at end of file diff --git a/data/src/main/resources/bin/100/startprod.sh b/data/src/main/resources/bin/100/startprod.sh new file mode 100644 index 00000000..aefd9623 --- /dev/null +++ b/data/src/main/resources/bin/100/startprod.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Spring Boot 项目启动脚本 +JAR_PATH="/home/app/data" +JAR_NAME="data-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/data/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + +# 函数定义 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 检查是否已运行 +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 检查Jar包是否存在 +check_jar_exists + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + + +# 启动项目 +echo "正在启动项目..." +nohup java ${JVM_OPTS} -Dspring.profiles.active=prod -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5002 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & \ No newline at end of file diff --git a/data/src/main/resources/bin/100/status.sh b/data/src/main/resources/bin/100/status.sh new file mode 100644 index 00000000..52cc4ca5 --- /dev/null +++ b/data/src/main/resources/bin/100/status.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Spring Boot 项目状态查询脚本 +JAR_NAME="data-0.0.1-SNAPSHOT.jar" +LOG_HOME="/home/app/data/logs" +LOG_FILE="${LOG_HOME}/running.log" + + +# 函数定义 +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 查看服务状态 +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目运行中!PID: ${PID}" + echo "日志文件路径:${LOG_FILE}" +else + echo "项目未在运行中" +fi diff --git a/data/src/main/resources/bin/100/stop.sh b/data/src/main/resources/bin/100/stop.sh new file mode 100644 index 00000000..2b96b228 --- /dev/null +++ b/data/src/main/resources/bin/100/stop.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Spring Boot 项目停止脚本 +JAR_NAME="data-0.0.1-SNAPSHOT.jar" + + +# 函数定义 +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 停止服务 +PID=$(get_running_pid) +if [ -z "${PID}" ]; then + echo "项目未在运行中,无需停止" + exit 0 +fi + +echo "正在停止项目... PID: ${PID}" +kill -15 "${PID}" + +WAIT=0 +while [ ${WAIT} -lt 10 ]; do + if [ -z "$(get_running_pid)" ]; then + echo "项目已优雅停止" + exit 0 + fi + sleep 1 + WAIT=$((WAIT + 1)) +done + +echo "优雅停止超时,强制终止进程... PID: ${PID}" +kill -9 "${PID}" + +sleep 2 +if [ -z "$(get_running_pid)" ]; then + echo "项目已强制停止" +else + echo "ERROR: 进程终止失败!请手动检查:ps -ef | grep ${JAR_NAME}" + exit 1 +fi diff --git a/data/src/main/resources/bin/190/start.sh b/data/src/main/resources/bin/190/start.sh index ed670570..d5edde9d 100644 --- a/data/src/main/resources/bin/190/start.sh +++ b/data/src/main/resources/bin/190/start.sh @@ -42,4 +42,4 @@ fi # 启动项目 echo "正在启动项目..." -nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-190 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5002 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & \ No newline at end of file +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-190 -DXXL_JOB_EXECUTOR_IP=192.168.190.161 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5002 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & \ No newline at end of file diff --git a/data/src/main/resources/bin/65/start.sh b/data/src/main/resources/bin/65/start.sh index b6691f6f..95077b49 100644 --- a/data/src/main/resources/bin/65/start.sh +++ b/data/src/main/resources/bin/65/start.sh @@ -42,4 +42,4 @@ fi # 启动项目 echo "正在启动项目..." -nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-65 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5002 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & \ No newline at end of file +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-65 -DXXL_JOB_EXECUTOR_IP=192.168.65.161 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5002 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & \ No newline at end of file diff --git a/flowable/src/main/resources/bin/100/log.sh b/flowable/src/main/resources/bin/100/log.sh new file mode 100644 index 00000000..03d8b2a0 --- /dev/null +++ b/flowable/src/main/resources/bin/100/log.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Spring Boot 项目日志查看脚本 +LOG_HOME="/home/app/flowable/logs" +LOG_FILE="${LOG_HOME}/running.log" + + +# 查看实时日志 +if [ ! -f "${LOG_FILE}" ]; then + echo "日志文件不存在:${LOG_FILE}(可能项目未启动)" + exit 1 +fi +echo "正在查看实时运行日志(按 Ctrl+C 退出)... 日志路径:${LOG_FILE}" +tail -f "${LOG_FILE}" diff --git a/flowable/src/main/resources/bin/100/restart.sh b/flowable/src/main/resources/bin/100/restart.sh new file mode 100644 index 00000000..17bb2695 --- /dev/null +++ b/flowable/src/main/resources/bin/100/restart.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Spring Boot 项目重启脚本 + +# 定义基础路径(公共参数) +BASE_DIR="/home/app/flowable" + +echo "=== 开始重启项目 ===" + +# 先停止服务 +if [ -f "${BASE_DIR}/stop.sh" ]; then + "${BASE_DIR}/stop.sh" +else + echo "错误:未找到停止脚本 ${BASE_DIR}/stop.sh" + exit 1 +fi + +# 再启动服务 +if [ -f "${BASE_DIR}/start.sh" ]; then + "${BASE_DIR}/start.sh" +else + echo "错误:未找到启动脚本 ${BASE_DIR}/start.sh" + exit 1 +fi + +echo "=== 重启操作完成 ===" \ No newline at end of file diff --git a/flowable/src/main/resources/bin/100/start.sh b/flowable/src/main/resources/bin/100/start.sh new file mode 100644 index 00000000..8b3cb59e --- /dev/null +++ b/flowable/src/main/resources/bin/100/start.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Spring Boot 项目启动脚本 +JAR_PATH="/home/app/flowable" +JAR_NAME="flowable-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/flowable/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + +# 函数定义 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 检查是否已运行 +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 检查Jar包是否存在 +check_jar_exists + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + + +# 启动项目 +echo "正在启动项目..." +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-100 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5003 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & diff --git a/flowable/src/main/resources/bin/100/startprod.sh b/flowable/src/main/resources/bin/100/startprod.sh new file mode 100644 index 00000000..557e79ce --- /dev/null +++ b/flowable/src/main/resources/bin/100/startprod.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Spring Boot 项目启动脚本 +JAR_PATH="/home/app/flowable" +JAR_NAME="flowable-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/flowable/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + +# 函数定义 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 检查是否已运行 +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 检查Jar包是否存在 +check_jar_exists + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + + +# 启动项目 +echo "正在启动项目..." +nohup java ${JVM_OPTS} -Dspring.profiles.active=prod -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5003 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & diff --git a/flowable/src/main/resources/bin/100/status.sh b/flowable/src/main/resources/bin/100/status.sh new file mode 100644 index 00000000..251f861a --- /dev/null +++ b/flowable/src/main/resources/bin/100/status.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Spring Boot 项目状态查询脚本 +JAR_NAME="flowable-0.0.1-SNAPSHOT.jar" +LOG_HOME="/home/app/flowable/logs" +LOG_FILE="${LOG_HOME}/running.log" + + +# 函数定义 +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 查看服务状态 +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目运行中!PID: ${PID}" + echo "日志文件路径:${LOG_FILE}" +else + echo "项目未在运行中" +fi diff --git a/flowable/src/main/resources/bin/100/stop.sh b/flowable/src/main/resources/bin/100/stop.sh new file mode 100644 index 00000000..d10acb17 --- /dev/null +++ b/flowable/src/main/resources/bin/100/stop.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Spring Boot 项目停止脚本 +JAR_NAME="flowable-0.0.1-SNAPSHOT.jar" + + +# 函数定义 +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 停止服务 +PID=$(get_running_pid) +if [ -z "${PID}" ]; then + echo "项目未在运行中,无需停止" + exit 0 +fi + +echo "正在停止项目... PID: ${PID}" +kill -15 "${PID}" + +WAIT=0 +while [ ${WAIT} -lt 10 ]; do + if [ -z "$(get_running_pid)" ]; then + echo "项目已优雅停止" + exit 0 + fi + sleep 1 + WAIT=$((WAIT + 1)) +done + +echo "优雅停止超时,强制终止进程... PID: ${PID}" +kill -9 "${PID}" + +sleep 2 +if [ -z "$(get_running_pid)" ]; then + echo "项目已强制停止" +else + echo "ERROR: 进程终止失败!请手动检查:ps -ef | grep ${JAR_NAME}" + exit 1 +fi diff --git a/gateway2/src/main/resources/bin/100/log.sh b/gateway2/src/main/resources/bin/100/log.sh new file mode 100644 index 00000000..6f49008f --- /dev/null +++ b/gateway2/src/main/resources/bin/100/log.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Spring Boot 网关项目日志查看脚本 +LOG_HOME="/home/app/gateway2/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# 查看实时日志 +if [ ! -f "${LOG_FILE}" ]; then + echo "日志文件不存在:${LOG_FILE}(可能项目未启动)" + exit 1 +fi +echo "正在查看实时运行日志(按 Ctrl+C 退出)... 日志路径:${LOG_FILE}" +tail -f "${LOG_FILE}" diff --git a/gateway2/src/main/resources/bin/100/restart.sh b/gateway2/src/main/resources/bin/100/restart.sh new file mode 100644 index 00000000..d02388c5 --- /dev/null +++ b/gateway2/src/main/resources/bin/100/restart.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Spring Boot 项目重启脚本 + +# 定义基础路径(公共参数) +BASE_DIR="/home/app/gateway2" + +echo "=== 开始重启项目 ===" + +# 先停止服务 +if [ -f "${BASE_DIR}/stop.sh" ]; then + "${BASE_DIR}/stop.sh" +else + echo "错误:未找到停止脚本 ${BASE_DIR}/stop.sh" + exit 1 +fi + +# 再启动服务 +if [ -f "${BASE_DIR}/start.sh" ]; then + "${BASE_DIR}/start.sh" +else + echo "错误:未找到启动脚本 ${BASE_DIR}/start.sh" + exit 1 +fi + +echo "=== 重启操作完成 ===" \ No newline at end of file diff --git a/gateway2/src/main/resources/bin/100/start.sh b/gateway2/src/main/resources/bin/100/start.sh new file mode 100644 index 00000000..a7697e24 --- /dev/null +++ b/gateway2/src/main/resources/bin/100/start.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# Spring Boot 网关项目启动脚本 +JAR_PATH="/home/app/gateway2" +JAR_NAME="gateway2-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/gateway2/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xmx2g -Xms2g -XX:MaxDirectMemorySize=2g -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + + +# 函数定义 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + + + +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 检查jar包是否存在 +check_jar_exists + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + +# 启动项目 +echo "正在启动项目..." +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-100 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & + + diff --git a/gateway2/src/main/resources/bin/100/startprod.sh b/gateway2/src/main/resources/bin/100/startprod.sh new file mode 100644 index 00000000..3210048e --- /dev/null +++ b/gateway2/src/main/resources/bin/100/startprod.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# Spring Boot 网关项目启动脚本 +JAR_PATH="/home/app/gateway2" +JAR_NAME="gateway2-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/gateway2/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xmx2g -Xms2g -XX:MaxDirectMemorySize=2g -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + + +# 函数定义 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + + + +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 检查jar包是否存在 +check_jar_exists + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + +# 启动项目 +echo "正在启动项目..." +nohup java ${JVM_OPTS} -Dspring.profiles.active=prod -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & + + diff --git a/gateway2/src/main/resources/bin/100/status.sh b/gateway2/src/main/resources/bin/100/status.sh new file mode 100644 index 00000000..16acbb8a --- /dev/null +++ b/gateway2/src/main/resources/bin/100/status.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Spring Boot 网关项目状态查询脚本 +JAR_NAME="gateway2-0.0.1-SNAPSHOT.jar" +LOG_HOME="/home/app/gateway2/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# 函数定义 +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 查看服务状态 +local PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目运行中!PID: ${PID}" + echo "日志文件路径:${LOG_FILE}" +else + echo "项目未在运行中" +fi diff --git a/gateway2/src/main/resources/bin/100/stop.sh b/gateway2/src/main/resources/bin/100/stop.sh new file mode 100644 index 00000000..66924f09 --- /dev/null +++ b/gateway2/src/main/resources/bin/100/stop.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Spring Boot 项目强制停止脚本 +JAR_NAME="gateway2-0.0.1-SNAPSHOT.jar" + +# 函数定义 +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 停止服务 +PID=$(get_running_pid) +if [ -z "${PID}" ]; then + echo "项目未在运行中,无需停止" + exit 0 +fi + +echo "正在停止项目... PID: ${PID}" +kill -15 "${PID}" + +WAIT=0 +while [ ${WAIT} -lt 10 ]; do + if [ -z "$(get_running_pid)" ]; then + echo "项目已优雅停止" + exit 0 + fi + sleep 1 + WAIT=$((WAIT + 1)) +done + +echo "优雅停止超时,强制终止进程... PID: ${PID}" +kill -9 "${PID}" + +sleep 2 +if [ -z "$(get_running_pid)" ]; then + echo "项目已强制停止" +else + echo "ERROR: 进程终止失败!请手动检查:ps -ef | grep ${JAR_NAME}" + exit 1 +fi diff --git a/pbs/src/main/resources/bin/100/log.sh b/pbs/src/main/resources/bin/100/log.sh new file mode 100644 index 00000000..5b0f38d2 --- /dev/null +++ b/pbs/src/main/resources/bin/100/log.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Spring Boot 项目日志查看脚本 +LOG_HOME="/home/app/pbs/logs" +LOG_FILE="${LOG_HOME}/running.log" + + +# 查看实时日志 +if [ ! -f "${LOG_FILE}" ]; then + echo "日志文件不存在:${LOG_FILE}(可能项目未启动)" + exit 1 +fi +echo "正在查看实时运行日志(按 Ctrl+C 退出)... 日志路径:${LOG_FILE}" +tail -f "${LOG_FILE}" diff --git a/pbs/src/main/resources/bin/100/restart.sh b/pbs/src/main/resources/bin/100/restart.sh new file mode 100644 index 00000000..82f7899a --- /dev/null +++ b/pbs/src/main/resources/bin/100/restart.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Spring Boot 项目重启脚本 + +# 定义基础路径(公共参数) +BASE_DIR="/home/app/pbs" + +echo "=== 开始重启项目 ===" + +# 先停止服务 +if [ -f "${BASE_DIR}/stop.sh" ]; then + "${BASE_DIR}/stop.sh" +else + echo "错误:未找到停止脚本 ${BASE_DIR}/stop.sh" + exit 1 +fi + +# 再启动服务 +if [ -f "${BASE_DIR}/start.sh" ]; then + "${BASE_DIR}/start.sh" +else + echo "错误:未找到启动脚本 ${BASE_DIR}/start.sh" + exit 1 +fi + +echo "=== 重启操作完成 ===" \ No newline at end of file diff --git a/pbs/src/main/resources/bin/100/start.sh b/pbs/src/main/resources/bin/100/start.sh new file mode 100644 index 00000000..e468bdcc --- /dev/null +++ b/pbs/src/main/resources/bin/100/start.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Spring Boot 项目启动脚本 +JAR_PATH="/home/app/pbs" +JAR_NAME="pbs-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/pbs/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + +# 函数定义 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 检查是否已运行 +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 检查Jar包是否存在 +check_jar_exists + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + + +# 启动项目 +echo "正在启动项目..." +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-100 -DXXL_JOB_EXECUTOR_IP=192.168.65.161 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5004 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & diff --git a/pbs/src/main/resources/bin/100/startprod.sh b/pbs/src/main/resources/bin/100/startprod.sh new file mode 100644 index 00000000..e7c6ee4d --- /dev/null +++ b/pbs/src/main/resources/bin/100/startprod.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Spring Boot 项目启动脚本 +JAR_PATH="/home/app/pbs" +JAR_NAME="pbs-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/pbs/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + +# 函数定义 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 检查是否已运行 +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 检查Jar包是否存在 +check_jar_exists + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + + +# 启动项目 +echo "正在启动项目..." +nohup java ${JVM_OPTS} -Dspring.profiles.active=prod -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5004 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & diff --git a/pbs/src/main/resources/bin/100/status.sh b/pbs/src/main/resources/bin/100/status.sh new file mode 100644 index 00000000..66701385 --- /dev/null +++ b/pbs/src/main/resources/bin/100/status.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Spring Boot 项目状态查询脚本 +JAR_NAME="pbs-0.0.1-SNAPSHOT.jar" +LOG_HOME="/home/app/pbs/logs" +LOG_FILE="${LOG_HOME}/running.log" + + +# 函数定义 +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 查看服务状态 +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目运行中!PID: ${PID}" + echo "日志文件路径:${LOG_FILE}" +else + echo "项目未在运行中" +fi diff --git a/pbs/src/main/resources/bin/100/stop.sh b/pbs/src/main/resources/bin/100/stop.sh new file mode 100644 index 00000000..f42b3392 --- /dev/null +++ b/pbs/src/main/resources/bin/100/stop.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Spring Boot 项目强制停止脚本 +JAR_NAME="pbs-0.0.1-SNAPSHOT.jar" + +# 函数定义:获取运行中的进程ID +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 获取进程ID +PID=$(get_running_pid) + +# 检查进程是否存在 +if [ -z "${PID}" ]; then + echo "项目未在运行中,无需停止" + exit 0 +fi + +# 强制停止进程 +echo "正在强制停止项目... PID: ${PID}" +kill -9 "${PID}" + +# 检查是否成功停止 +sleep 5 +if [ -z "$(get_running_pid)" ]; then + echo "项目已强制停止成功" + exit 0 +else + echo "ERROR: 进程终止失败!请手动检查:ps -ef | grep ${JAR_NAME}" + exit 1 +fi diff --git a/pbs/src/main/resources/bin/190/start.sh b/pbs/src/main/resources/bin/190/start.sh index 4ad90063..993a7e62 100644 --- a/pbs/src/main/resources/bin/190/start.sh +++ b/pbs/src/main/resources/bin/190/start.sh @@ -42,4 +42,4 @@ fi # 启动项目 echo "正在启动项目..." -nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-190 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5004 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-190 -DXXL_JOB_EXECUTOR_IP=192.168.190.161 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5004 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & diff --git a/pbs/src/main/resources/bin/65/start.sh b/pbs/src/main/resources/bin/65/start.sh index c241790f..33878748 100644 --- a/pbs/src/main/resources/bin/65/start.sh +++ b/pbs/src/main/resources/bin/65/start.sh @@ -42,4 +42,4 @@ fi # 启动项目 echo "正在启动项目..." -nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-65 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5004 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-65 -DXXL_JOB_EXECUTOR_IP=192.168.65.161 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5004 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & diff --git a/project/src/main/resources/bin/100/log.sh b/project/src/main/resources/bin/100/log.sh new file mode 100644 index 00000000..08d1fd32 --- /dev/null +++ b/project/src/main/resources/bin/100/log.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Spring Boot 项目日志查看脚本 +LOG_HOME="/home/app/project/logs" +LOG_FILE="${LOG_HOME}/running.log" + + +# 查看实时日志 +if [ ! -f "${LOG_FILE}" ]; then + echo "日志文件不存在:${LOG_FILE}(可能项目未启动)" + exit 1 +fi +echo "正在查看实时运行日志(按 Ctrl+C 退出)... 日志路径:${LOG_FILE}" +tail -f "${LOG_FILE}" diff --git a/project/src/main/resources/bin/100/restart.sh b/project/src/main/resources/bin/100/restart.sh new file mode 100644 index 00000000..15071485 --- /dev/null +++ b/project/src/main/resources/bin/100/restart.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Spring Boot 项目重启脚本 + +# 定义基础路径(公共参数) +BASE_DIR="/home/app/project" + +echo "=== 开始重启项目 ===" + +# 先停止服务 +if [ -f "${BASE_DIR}/stop.sh" ]; then + "${BASE_DIR}/stop.sh" +else + echo "错误:未找到停止脚本 ${BASE_DIR}/stop.sh" + exit 1 +fi + +# 再启动服务 +if [ -f "${BASE_DIR}/start.sh" ]; then + "${BASE_DIR}/start.sh" +else + echo "错误:未找到启动脚本 ${BASE_DIR}/start.sh" + exit 1 +fi + +echo "=== 重启操作完成 ===" \ No newline at end of file diff --git a/project/src/main/resources/bin/100/start.sh b/project/src/main/resources/bin/100/start.sh new file mode 100644 index 00000000..812e58bf --- /dev/null +++ b/project/src/main/resources/bin/100/start.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Spring Boot 项目启动脚本 +JAR_PATH="/home/app/project" +JAR_NAME="project-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/project/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + +# 函数定义 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 检查是否已运行 +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 启动服务 +check_jar_exists + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + +echo "正在启动项目... " + +# 启动项目并保留控制台输出 +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-100 -DXXL_JOB_EXECUTOR_IP=192.168.65.161 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5005 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & diff --git a/project/src/main/resources/bin/100/startprod.sh b/project/src/main/resources/bin/100/startprod.sh new file mode 100644 index 00000000..0c88247e --- /dev/null +++ b/project/src/main/resources/bin/100/startprod.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Spring Boot 项目启动脚本 +JAR_PATH="/home/app/project" +JAR_NAME="project-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/project/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + +# 函数定义 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 检查是否已运行 +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 启动服务 +check_jar_exists + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + +echo "正在启动项目... " + +# 启动项目并保留控制台输出 +nohup java ${JVM_OPTS} -Dspring.profiles.active=prod -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5005 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & diff --git a/project/src/main/resources/bin/100/status.sh b/project/src/main/resources/bin/100/status.sh new file mode 100644 index 00000000..5400f647 --- /dev/null +++ b/project/src/main/resources/bin/100/status.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Spring Boot 项目状态查询脚本 +JAR_NAME="project-0.0.1-SNAPSHOT.jar" +LOG_HOME="/home/app/project/logs" +LOG_FILE="${LOG_HOME}/running.log" + + +# 函数定义 +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 查看服务状态 +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目运行中!PID: ${PID}" + echo "日志文件路径:${LOG_FILE}" +else + echo "项目未在运行中" +fi diff --git a/project/src/main/resources/bin/100/stop.sh b/project/src/main/resources/bin/100/stop.sh new file mode 100644 index 00000000..b04ad531 --- /dev/null +++ b/project/src/main/resources/bin/100/stop.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Spring Boot 项目强制停止脚本 +JAR_NAME="project-0.0.1-SNAPSHOT.jar" + +# 函数定义:获取运行中的进程ID +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 获取进程ID +PID=$(get_running_pid) + +# 检查进程是否存在 +if [ -z "${PID}" ]; then + echo "项目未在运行中,无需停止" + exit 0 +fi + +# 强制停止进程 +echo "正在强制停止项目... PID: ${PID}" +kill -9 "${PID}" + +# 检查是否成功停止 +sleep 5 +if [ -z "$(get_running_pid)" ]; then + echo "项目已强制停止成功" + exit 0 +else + echo "ERROR: 进程终止失败!请手动检查:ps -ef | grep ${JAR_NAME}" + exit 1 +fi diff --git a/project/src/main/resources/bin/190/start.sh b/project/src/main/resources/bin/190/start.sh index 5b8140c5..bcaf9089 100644 --- a/project/src/main/resources/bin/190/start.sh +++ b/project/src/main/resources/bin/190/start.sh @@ -42,4 +42,4 @@ fi echo "正在启动项目... " # 启动项目并保留控制台输出 -nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-190 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5005 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-190 -DXXL_JOB_EXECUTOR_IP=192.168.190.161 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5005 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & diff --git a/project/src/main/resources/bin/65/start.sh b/project/src/main/resources/bin/65/start.sh index d5a14c55..51ac3ad1 100644 --- a/project/src/main/resources/bin/65/start.sh +++ b/project/src/main/resources/bin/65/start.sh @@ -42,4 +42,4 @@ fi echo "正在启动项目... " # 启动项目并保留控制台输出 -nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-65 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5005 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-65 -DXXL_JOB_EXECUTOR_IP=192.168.65.161 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5005 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & diff --git a/system/src/main/resources/bin/100/log.sh b/system/src/main/resources/bin/100/log.sh new file mode 100644 index 00000000..a3e001ec --- /dev/null +++ b/system/src/main/resources/bin/100/log.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Spring Boot 项目日志查看脚本 +LOG_HOME="/home/app/system/logs" +LOG_FILE="${LOG_HOME}/running.log" + + +# 查看实时日志 +if [ ! -f "${LOG_FILE}" ]; then + echo "日志文件不存在:${LOG_FILE}(可能项目未启动)" + exit 1 +fi +echo "正在查看实时运行日志(按 Ctrl+C 退出)... 日志路径:${LOG_FILE}" +tail -f "${LOG_FILE}" diff --git a/system/src/main/resources/bin/100/restart.sh b/system/src/main/resources/bin/100/restart.sh new file mode 100644 index 00000000..15e3a604 --- /dev/null +++ b/system/src/main/resources/bin/100/restart.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Spring Boot 项目重启脚本 + +# 定义基础路径(公共参数) +BASE_DIR="/home/app/system" + +echo "=== 开始重启项目 ===" + +# 先停止服务 +if [ -f "${BASE_DIR}/stop.sh" ]; then + "${BASE_DIR}/stop.sh" +else + echo "错误:未找到停止脚本 ${BASE_DIR}/stop.sh" + exit 1 +fi + +# 再启动服务 +if [ -f "${BASE_DIR}/start.sh" ]; then + "${BASE_DIR}/start.sh" +else + echo "错误:未找到启动脚本 ${BASE_DIR}/start.sh" + exit 1 +fi + +echo "=== 重启操作完成 ===" \ No newline at end of file diff --git a/system/src/main/resources/bin/100/start.sh b/system/src/main/resources/bin/100/start.sh new file mode 100644 index 00000000..b5a8cb16 --- /dev/null +++ b/system/src/main/resources/bin/100/start.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Spring Boot 项目启动脚本(不修改logback配置,实时打印日志) +JAR_PATH="/home/app/system" +JAR_NAME="system-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/system/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + + +# 函数定义 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 启动服务 +check_jar_exists + +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + +echo "正在启动项目..." + +# 启动项目,保留控制台输出 +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-100 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5006 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & + diff --git a/system/src/main/resources/bin/100/startprod.sh b/system/src/main/resources/bin/100/startprod.sh new file mode 100644 index 00000000..b60925b8 --- /dev/null +++ b/system/src/main/resources/bin/100/startprod.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Spring Boot 项目启动脚本(不修改logback配置,实时打印日志) +JAR_PATH="/home/app/system" +JAR_NAME="system-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/system/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + + +# 函数定义 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 启动服务 +check_jar_exists + +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + +echo "正在启动项目..." + +# 启动项目,保留控制台输出 +nohup java ${JVM_OPTS} -Dspring.profiles.active=prod -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5006 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & + diff --git a/system/src/main/resources/bin/100/status.sh b/system/src/main/resources/bin/100/status.sh new file mode 100644 index 00000000..6afe6255 --- /dev/null +++ b/system/src/main/resources/bin/100/status.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Spring Boot 项目状态查看脚本 +JAR_NAME="system-0.0.1-SNAPSHOT.jar" +LOG_HOME="/home/app/system/logs" +LOG_FILE="${LOG_HOME}/running.log" + + +# 函数定义 +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 查看服务状态 +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目运行中!PID: ${PID}" + echo "日志文件路径:${LOG_FILE}" +else + echo "项目未在运行中" +fi diff --git a/system/src/main/resources/bin/100/stop.sh b/system/src/main/resources/bin/100/stop.sh new file mode 100644 index 00000000..39db662b --- /dev/null +++ b/system/src/main/resources/bin/100/stop.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Spring Boot 项目强制停止脚本 +JAR_NAME="system-0.0.1-SNAPSHOT.jar" + +# 函数定义:获取运行中的进程ID +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 获取进程ID +PID=$(get_running_pid) + +# 检查进程是否存在 +if [ -z "${PID}" ]; then + echo "项目未在运行中,无需停止" + exit 0 +fi + +# 强制停止进程 +echo "正在强制停止项目... PID: ${PID}" +kill -9 "${PID}" + +# 检查是否成功停止 +sleep 5 +if [ -z "$(get_running_pid)" ]; then + echo "项目已强制停止成功" + exit 0 +else + echo "ERROR: 进程终止失败!请手动检查:ps -ef | grep ${JAR_NAME}" + exit 1 +fi diff --git a/task/src/main/resources/bin/100/log.sh b/task/src/main/resources/bin/100/log.sh new file mode 100644 index 00000000..099f64c4 --- /dev/null +++ b/task/src/main/resources/bin/100/log.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Spring Boot 项目日志查看脚本 +LOG_HOME="/home/app/task/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# 查看实时日志 +if [ ! -f "${LOG_FILE}" ]; then + echo "日志文件不存在:${LOG_FILE}(可能项目未启动)" + exit 1 +fi +echo "正在查看实时运行日志(按 Ctrl+C 退出)... 日志路径:${LOG_FILE}" +tail -f "${LOG_FILE}" diff --git a/task/src/main/resources/bin/100/restart.sh b/task/src/main/resources/bin/100/restart.sh new file mode 100644 index 00000000..31c7617a --- /dev/null +++ b/task/src/main/resources/bin/100/restart.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Spring Boot 项目重启脚本 + +# 定义基础路径(公共参数) +BASE_DIR="/home/app/task" + +echo "=== 开始重启项目 ===" + +# 先停止服务 +if [ -f "${BASE_DIR}/stop.sh" ]; then + "${BASE_DIR}/stop.sh" +else + echo "错误:未找到停止脚本 ${BASE_DIR}/stop.sh" + exit 1 +fi + +# 再启动服务 +if [ -f "${BASE_DIR}/start.sh" ]; then + "${BASE_DIR}/start.sh" +else + echo "错误:未找到启动脚本 ${BASE_DIR}/start.sh" + exit 1 +fi + +echo "=== 重启操作完成 ===" \ No newline at end of file diff --git a/task/src/main/resources/bin/100/start.sh b/task/src/main/resources/bin/100/start.sh new file mode 100644 index 00000000..74721d72 --- /dev/null +++ b/task/src/main/resources/bin/100/start.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# Spring Boot 项目启动脚本 +JAR_PATH="/home/app/task" +JAR_NAME="task-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/task/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + +# 检查Jar包是否存在 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +# 获取运行中的进程PID +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 启动服务 +check_jar_exists + +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + +echo "正在启动项目..." +echo "======================================================================" + +# 启动项目,保留控制台输出 +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev-100 -Dspdm.enkey=XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5007 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & + diff --git a/task/src/main/resources/bin/100/startprod.sh b/task/src/main/resources/bin/100/startprod.sh new file mode 100644 index 00000000..1bfccb3f --- /dev/null +++ b/task/src/main/resources/bin/100/startprod.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# Spring Boot 项目启动脚本 +JAR_PATH="/home/app/task" +JAR_NAME="task-0.0.1-SNAPSHOT.jar" +FULL_JAR_PATH="${JAR_PATH}/${JAR_NAME}" + +# 与logback.xml保持一致的日志路径 +LOG_HOME="/home/app/task/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# JVM参数 +JVM_OPTS="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_HOME}/heapdump.hprof" + +# 检查Jar包是否存在 +check_jar_exists() { + if [ ! -f "${FULL_JAR_PATH}" ]; then + echo "ERROR: Jar包不存在!路径:${FULL_JAR_PATH}" + exit 1 + fi +} + +# 获取运行中的进程PID +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 启动服务 +check_jar_exists + +PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目已在运行中!PID: ${PID}" + exit 0 +fi + +# 确保日志目录存在 +if [ ! -d "${LOG_HOME}" ]; then + mkdir -p "${LOG_HOME}" + echo "日志目录不存在,已自动创建:${LOG_HOME}" +fi + +echo "正在启动项目..." +echo "======================================================================" + +# 启动项目,保留控制台输出 +nohup java ${JVM_OPTS} -Dspring.profiles.active=prod -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5007 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & + diff --git a/task/src/main/resources/bin/100/status.sh b/task/src/main/resources/bin/100/status.sh new file mode 100644 index 00000000..5a5c8504 --- /dev/null +++ b/task/src/main/resources/bin/100/status.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Spring Boot 项目状态查看脚本 +JAR_NAME="task-0.0.1-SNAPSHOT.jar" +LOG_HOME="/home/app/task/logs" +LOG_FILE="${LOG_HOME}/running.log" + +# 获取运行中的进程PID +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +local PID=$(get_running_pid) +if [ -n "${PID}" ]; then + echo "项目运行中!PID: ${PID}" + echo "日志文件路径:${LOG_FILE}" +else + echo "项目未在运行中" +fi diff --git a/task/src/main/resources/bin/100/stop.sh b/task/src/main/resources/bin/100/stop.sh new file mode 100644 index 00000000..ca5f105b --- /dev/null +++ b/task/src/main/resources/bin/100/stop.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Spring Boot 项目停止脚本 +JAR_NAME="task-0.0.1-SNAPSHOT.jar" + + +# 函数定义 +get_running_pid() { + ps -ef | grep "${JAR_NAME}" | grep -v "grep" | awk '{print $2}' +} + +# 停止服务 +PID=$(get_running_pid) +if [ -z "${PID}" ]; then + echo "项目未在运行中,无需停止" + exit 0 +fi + +echo "正在停止项目... PID: ${PID}" +kill -15 "${PID}" + +WAIT=0 +while [ ${WAIT} -lt 10 ]; do + if [ -z "$(get_running_pid)" ]; then + echo "项目已优雅停止" + exit 0 + fi + sleep 1 + WAIT=$((WAIT + 1)) +done + +echo "优雅停止超时,强制终止进程... PID: ${PID}" +kill -9 "${PID}" + +sleep 2 +if [ -z "$(get_running_pid)" ]; then + echo "项目已强制停止" +else + echo "ERROR: 进程终止失败!请手动检查:ps -ef | grep ${JAR_NAME}" + exit 1 +fi