Skip to content

Commit 5b85dcb

Browse files
committed
chore: 스크립트 수정
1 parent 7d02df0 commit 5b85dcb

1 file changed

Lines changed: 6 additions & 22 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,11 @@ jobs:
4545
username: ${{ secrets.EC2_USER }}
4646
key: ${{ secrets.EC2_SSH_KEY }}
4747
script: |
48-
echo "Stopping existing application if running..."
49-
if pgrep -f "java -jar"; then
50-
pkill -f "java -jar"
51-
sleep 5
52-
fi
53-
54-
echo "Finding latest JAR..."
55-
JAR_PATH=$(ls -t /home/ubuntu/app/build/libs/*.jar | head -n 1)
56-
echo "Using JAR: $JAR_PATH"
57-
58-
echo "Export DB environment variable..."
59-
export DB_PASSWORD='${{ secrets.DB_PASSWORD }}'
48+
cd /home/ubuntu/app
6049
61-
echo "Starting application..."
62-
nohup java -jar "$JAR_PATH" \
63-
> /home/ubuntu/app/app.log 2>&1 &
50+
pkill -f "java -jar" || true
6451
65-
sleep 3
66-
if pgrep -f "java -jar"; then
67-
echo "Application started successfully."
68-
else
69-
echo "Application failed to start."
70-
exit 1
71-
fi
52+
JAR_PATH=$(ls -t build/libs/*.jar | head -n 1)
53+
54+
nohup DB_PASSWORD='${{ secrets.DB_PASSWORD }}' \
55+
java -jar "$JAR_PATH" > app.log 2>&1 &

0 commit comments

Comments
 (0)