From 9b660743c053387b020165bb5f9aa89a9aa92a38 Mon Sep 17 00:00:00 2001 From: kim_sang_ june <79149384+drbug2000@users.noreply.github.com> Date: Sun, 7 Jul 2024 17:20:29 +0900 Subject: [PATCH 1/2] Create deploy.sh --- deploy.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 deploy.sh diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 00000000..155a64c5 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,16 @@ +#!/bin/bash + CURRENT_PID=$(pgrep -f .jar) + echo "$CURRENT_PID" + if [ -z $CURRENT_PID ]; then + echo "no process" + else + echo "kill $CURRENT_PID" + kill -9 $CURRENT_PID + sleep 3 + fi + + JAR_PATH="/home/ec2-user/cicd/*.jar" + echo "jar path : $JAR_PATH" + chmod +x $JAR_PATH + nohup java -jar $JAR_PATH > /dev/null 2> /dev/null < /dev/null & + echo "jar fild deploy success" From e635a8567b70ba00f057a1dd6c76de2313b392a0 Mon Sep 17 00:00:00 2001 From: kim_sang_ june <79149384+drbug2000@users.noreply.github.com> Date: Sun, 7 Jul 2024 17:25:33 +0900 Subject: [PATCH 2/2] Update deploy.sh ec2-user -> ubuntu --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 155a64c5..73550136 100644 --- a/deploy.sh +++ b/deploy.sh @@ -9,7 +9,7 @@ sleep 3 fi - JAR_PATH="/home/ec2-user/cicd/*.jar" + JAR_PATH="/home/ubuntu/cicd/*.jar" echo "jar path : $JAR_PATH" chmod +x $JAR_PATH nohup java -jar $JAR_PATH > /dev/null 2> /dev/null < /dev/null &