From d4b71bab78cf13184a8047e08b67a7d3710f3f10 Mon Sep 17 00:00:00 2001 From: ALEX <2604434353@qq.com> Date: Wed, 6 Aug 2025 10:28:09 +0800 Subject: [PATCH] fix: modify the post-steps.sh --- bin/post-steps.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/bin/post-steps.sh b/bin/post-steps.sh index 74f3c41..682450a 100755 --- a/bin/post-steps.sh +++ b/bin/post-steps.sh @@ -1,14 +1,29 @@ #!/bin/bash +# +#PORT=8889 +#JAR_PATH="/home/zhangbiqiong/pro_eld_mqtt_compare/target/pro_eld_mqtt_compare-0.0.1-SNAPSHOT.jar" +# +## 检测端口是否被占用 +#if netstat -tuln | grep -q ":$PORT"; then +# echo "Port $PORT is already in use. Not starting application." +# exit 0 +#else +# echo "Port $PORT is free. Starting application..." +# nohup java -jar "$JAR_PATH" > /dev/null 2>&1 & +# echo "Application started with PID $!" +#fi PORT=8889 JAR_PATH="/home/zhangbiqiong/pro_eld_mqtt_compare/target/pro_eld_mqtt_compare-0.0.1-SNAPSHOT.jar" +LOG_DIR="/home/zhangbiqiong/pro_eld_mqtt_compare/logs" + +cd /home/zhangbiqiong/pro_eld_mqtt_compare || { echo "Failed to cd"; exit 1; } -# 检测端口是否被占用 if netstat -tuln | grep -q ":$PORT"; then echo "Port $PORT is already in use. Not starting application." exit 0 else echo "Port $PORT is free. Starting application..." - nohup java -jar /home/zhangbiqiong/pro_eld_mqtt_compare/target/pro_eld_mqtt_compare-0.0.1-SNAPSHOT.jar > /dev/null 2>&1 & + nohup java -DLOG_HOME="$LOG_DIR" -jar "$JAR_PATH" > "$LOG_DIR/nohup.out" 2>&1 & echo "Application started with PID $!" fi \ No newline at end of file