Skip to content

Commit

Permalink
chore: 로그 저장 위치 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
SSung023 committed Apr 7, 2024
1 parent 247f274 commit 93b8056
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
#!/bin/bash

BUILD_JAR=$(ls /home/ec2-user/action/build/libs/*.jar)
BUILD_JAR=$(ls /home/ubuntu/action/build/libs/*.jar)
JAR_NAME=$(basename "$BUILD_JAR")
echo ">>> build 파일명: $JAR_NAME" >> /home/ec2-user/action/deploy.log
echo ">>> build 파일명: $JAR_NAME" >> /home/ubuntu/action/deploy.log

echo ">>> build 파일 복사" >> /home/ec2-user/action/deploy.log
DEPLOY_PATH=/home/ec2-user/action/
echo ">>> build 파일 복사" >> /home/ubuntu/action/deploy.log
DEPLOY_PATH=/home/ubuntu/action/
cp "$BUILD_JAR" $DEPLOY_PATH

echo ">>> 현재 실행중인 애플리케이션 pid 확인" >> /home/ec2-user/action/deploy.log
echo ">>> 현재 실행중인 애플리케이션 pid 확인" >> /home/ubuntu/action/deploy.log
CURRENT_PID=$(pgrep -f "$JAR_NAME")

if [ -z "$CURRENT_PID" ]
then
echo ">>> 현재 구동중인 애플리케이션이 없으므로 종료하지 않습니다." >> /home/ec2-user/action/deploy.log
echo ">>> 현재 구동중인 애플리케이션이 없으므로 종료하지 않습니다." >> /home/ubuntu/action/deploy.log
else
echo ">>> kill -15 $CURRENT_PID"
kill -15 "$CURRENT_PID"
sleep 5
fi

DEPLOY_JAR=$DEPLOY_PATH$JAR_NAME
echo ">>> DEPLOY_JAR 배포" >> /home/ec2-user/action/deploy.log
nohup java -jar "$DEPLOY_JAR" >> /home/ec2-user/deploy.log 2>/home/ec2-user/action/deploy_err.log &
echo ">>> DEPLOY_JAR 배포" >> /home/ubuntu/action/deploy.log
nohup java -jar "$DEPLOY_JAR" >> /home/ubuntu/deploy.log 2>/home/ubuntu/action/deploy_err.log &

0 comments on commit 93b8056

Please sign in to comment.