diff --git a/leopard-server/bin/start.sh b/leopard-server/bin/start.sh index b3cd8e3..2c9086d 100644 --- a/leopard-server/bin/start.sh +++ b/leopard-server/bin/start.sh @@ -1,3 +1,3 @@ #!/bin/bash -nohup /home/ubuntu/jdk-17.0.16+8/bin/java -jar /home/ubuntu/app/leopard-server-1.0.0.jar --spring.profiles.active=build --spring.web.resources.static-locations=file:/home/ubuntu/app/dist --logging.parent=/home/ubuntu/app > /dev/null 2>&1 & +nohup /home/ubuntu/jdk-21.0.8+9/bin/java -jar /home/ubuntu/app/leopard-server-1.0.0.jar --spring.profiles.active=build --spring.web.resources.static-locations=file:/home/ubuntu/app/dist --logging.parent=/home/ubuntu/app > /dev/null 2>&1 & diff --git a/leopard-server/bin/stop.sh b/leopard-server/bin/stop.sh index 3d6023b..b16ecea 100644 --- a/leopard-server/bin/stop.sh +++ b/leopard-server/bin/stop.sh @@ -1,10 +1,17 @@ #!/bin/bash original_command="$0" -application_name="/home/ubuntu/app/leopard-server-1.0.0.jar" +application_name="leopard-server-1.0.0.jar" function get_pid() { - echo $(ps ef | grep "$application_name" | grep -v grep | awk '{ print $1 }') + ID=$(ps -ef | grep "$application_name" | grep -v grep | grep -v $original_command | awk '{ print $2 }') + if [[ -z "$ID" ]]; then + ID=$(ps aux | grep "$application_name" | grep -v grep | grep -v $original_command | awk '{print $2}') + if [[ -z "$ID" ]]; then + ID=$(/home/ubuntu/jdk-21.0.8+9/bin/jps -lmvV | grep "$application_name" | awk '{print $1}') + fi + fi + echo $ID } pid=$(get_pid) @@ -31,3 +38,4 @@ while (true); do fi sleep 1s done +