14 lines
493 B
Bash
Executable File
14 lines
493 B
Bash
Executable File
#!/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 /home/zhangbiqiong/pro_eld_mqtt_compare/target/pro_eld_mqtt_compare-0.0.1-SNAPSHOT.jar > /dev/null 2>&1 &
|
|
echo "Application started with PID $!"
|
|
fi |