Skip to content

Commit

Permalink
Merge pull request #72 from team-verby/dev
Browse files Browse the repository at this point in the history
chore: ํฌํŠธ ์Šค์œ„์นญ ์ „, ํ”„๋กœ์„ธ์Šค ์ข…๋ฃŒ ์žฌ์‹œ๋„ ๋กœ์ง ์ถ”๊ฐ€
  • Loading branch information
pushedrumex authored Aug 11, 2024
2 parents d521f72 + 65ae52c commit 3de27b6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
4 changes: 1 addition & 3 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ if [ -z "$IDLE_PID" ]
then
echo "[ $(date +%c) ] $IDLE_PORT ํฌํŠธ์—์„œ ๊ตฌ๋™ ์ค‘์ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์—†์œผ๋ฏ€๋กœ ์ข…๋ฃŒํ•˜์ง€ ์•Š์Œ" >> $DEPLOY_LOG
else
echo "[ $(date +%c) ] kill -15 $IDLE_PID" >> $DEPLOY_LOG
kill -15 "$IDLE_PID"
sleep 5
sudo sh $SCRIPT_PATH/kill.sh $IDLE_PORT
fi

echo "[ $(date +%c) ] ์ƒˆ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ฐฐํฌ" >> $DEPLOY_LOG
Expand Down
29 changes: 29 additions & 0 deletions scripts/kill.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
PROJECT_ROOT=/home/ubuntu/app
DEPLOY_PATH=$PROJECT_ROOT/deploy
DEPLOY_LOG=$DEPLOY_PATH/deploy.log

IDLE_PORT=$1

for retry_count in $(seq 1 10)
do
IDLE_PID=$(lsof -ti tcp:${IDLE_PORT})

if [ -z "$IDLE_PID" ]
then
echo "[ $(date +%c) ] $IDLE_PORT ํฌํŠธ์—์„œ ๊ตฌ๋™ ์ค‘์ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์ข…๋ฃŒ๋จ" >> $DEPLOY_LOG
break
else
echo "[ $(date +%c) ] kill -15 $IDLE_PID" >> $DEPLOY_LOG
kill -15 "$IDLE_PID"
sleep 5
fi

if [ $retry_count -eq 10 ]
then
echo "[ $(date +%c) ] $IDLE_PORT kill ์‹คํŒจ." >> $DEPLOY_LOG
echo "[ $(date +%c) ] ์ƒˆ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋ฐฐํฌํ•˜์ง€ ์•Š๊ณ  ์ข…๋ฃŒ" >> $DEPLOY_LOG
exit 1
fi

echo "[ $(date +%c) ] $IDLE_PORT ํฌํŠธ์—์„œ ๊ตฌ๋™ ์ค‘์ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ข…๋ฃŒ ์‹คํŒจ. ์žฌ์‹œ๋„..." >> $DEPLOY_LOG
done

0 comments on commit 3de27b6

Please sign in to comment.