Skip to content

Commit

Permalink
ci: run_new_was.sh 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingyum-Kim committed Aug 6, 2023
1 parent c63a5be commit 9ba9889
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 37 deletions.
29 changes: 0 additions & 29 deletions scripts/deploy.sh

This file was deleted.

18 changes: 10 additions & 8 deletions scripts/run_new_was.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
# run_new_was.sh

#!/bin/bash

# Parse port number from 'service_url.inc'
CURRENT_PORT=$(cat /home/ubuntu/service_url.inc | grep -Po '[0-9]+' | tail -1)
TARGET_PORT=0

echo "> Current port of running WAS is ${CURRENT_PORT}."

# Find target port to switch
if [ ${CURRENT_PORT} -eq 8081 ]; then
TARGET_PORT=8082
TARGET_PORT=8082
elif [ ${CURRENT_PORT} -eq 8082 ]; then
TARGET_PORT=8081
TARGET_PORT=8081
else
echo "> No WAS is connected to nginx"
echo "> No WAS is connected to nginx"
fi

# query pid using the TCP protocol and using the port 'TARGET_PORT'
TARGET_PID=$(lsof -Fp -i TCP:${TARGET_PORT} | grep -Po 'p[0-9]+' | grep -Po '[0-9]+')

if [ ! -z ${TARGET_PID} ]; then
echo "> Kill WAS running at ${TARGET_PORT}."
sudo kill ${TARGET_PID}
echo "> Kill WAS running at ${TARGET_PORT}."
sudo kill ${TARGET_PID}
fi

nohup java -jar -Dserver.port=${TARGET_PORT} /home/ubuntu/playground-logging/build/libs/* > /home/ubuntu/nohup.out 2>&1 &
# run jar file in background
nohup java -jar -Dserver.port=${TARGET_PORT} /home/ubuntu/app/build/libs/* > /home/ubuntu/nohup.out 2>&1 &
echo "> Now new WAS runs at ${TARGET_PORT}."
exit 0

0 comments on commit 9ba9889

Please sign in to comment.