From 1f450e1e77d8230b059c21d7d52678ceae0e4f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=99=95=EC=8A=B9=EC=9E=AC?= Date: Sun, 4 Feb 2024 23:00:53 +0900 Subject: [PATCH] Create sop.sh --- scripts/sop.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 scripts/sop.sh diff --git a/scripts/sop.sh b/scripts/sop.sh new file mode 100644 index 0000000..bcd6aa2 --- /dev/null +++ b/scripts/sop.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +ROOT_PATH="/home/ubuntu/todaypopup" +JAR="$ROOT_PATH/application.jar" +STOP_LOG="$ROOT_PATH/stop.log" +SERVICE_PID=$(pgrep -f $JAR) # 실행중인 Spring 서버의 PID + +if [ -z "$SERVICE_PID" ]; then + echo "서비스 NouFound" >> $STOP_LOG +else + echo "서비스 종료 " >> $STOP_LOG + kill "$SERVICE_PID" + # kill -9 $SERVICE_PID # 강제 종료를 하고 싶다면 이 명령어 사용 +fi