Skip to content

Commit 0ec5c14

Browse files
committed
refactor: Update deploy settings
1 parent d921867 commit 0ec5c14

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

appspec.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ hooks:
1919
# - location: scripts/health_check.sh
2020
# timeout: 180
2121
# runas: ubuntu
22-
- location: scripts/switch.sh
23-
timeout: 180
24-
runas: ubuntu
22+
# - location: scripts/switch.sh
23+
# timeout: 180
24+
# runas: ubuntu

scripts/run_new_was.sh

+20-13
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,29 @@ CURRENT_PORT=$(cat /home/ubuntu/service_url.inc | grep -Po '[0-9]+' | tail -1)
33
TARGET_PORT=0
44

55
echo "> Current port of running WAS is ${CURRENT_PORT}."
6-
if [ ${CURRENT_PORT} -eq 8081 ]; then
7-
TARGET_PORT=8082
8-
elif [ ${CURRENT_PORT} -eq 8082 ]; then
9-
TARGET_PORT=8081
10-
else
11-
echo "> No WAS is connected to nginx"
12-
fi
6+
#if [ ${CURRENT_PORT} -eq 8081 ]; then
7+
# TARGET_PORT=8082
8+
#elif [ ${CURRENT_PORT} -eq 8082 ]; then
9+
# TARGET_PORT=8081
10+
#else
11+
# echo "> No WAS is connected to nginx"
12+
#fi
13+
14+
#TARGET_PID=$(lsof -Fp -i TCP:${TARGET_PORT} | grep -Po 'p[0-9]+' | grep -Po '[0-9]+')
15+
#
16+
#if [ ! -z ${TARGET_PID} ]; then
17+
# echo "> Kill WAS running at ${TARGET_PORT}."
18+
# sudo kill ${TARGET_PID}
19+
#fi
1320

14-
TARGET_PID=$(lsof -Fp -i TCP:${TARGET_PORT} | grep -Po 'p[0-9]+' | grep -Po '[0-9]+')
21+
CURRENT_PID=$(lsof -Fp -i TCP:${CURRENT_PORT} | grep -Po 'p[0-9]+' | grep -Po '[0-9]+')
1522

16-
if [ ! -z ${TARGET_PID} ]; then
17-
echo "> Kill WAS running at ${TARGET_PORT}."
18-
sudo kill ${TARGET_PID}
23+
if [ ! -z ${CURRENT_PID} ]; then
24+
echo "> Kill WAS running at ${CURRENT_PORT}."
25+
sudo kill ${CURRENT_PID}
1926
fi
2027

21-
nohup java -jar -Dserver.port=${TARGET_PORT} /home/ubuntu/sharebnb-deploy/build/libs/* >/home/ubuntu/nohup.out 2>&1 &
22-
echo "> Now new WAS runs at ${TARGET_PORT}."
28+
nohup java -jar -Dserver.port=${CURRENT_PORT} /home/ubuntu/sharebnb-deploy/build/libs/* >/home/ubuntu/nohup.out 2>&1 &
29+
echo "> Now new WAS runs at ${CURRENT_PORT}."
2330

2431
exit 0

0 commit comments

Comments
 (0)