@@ -3,22 +3,29 @@ CURRENT_PORT=$(cat /home/ubuntu/service_url.inc | grep -Po '[0-9]+' | tail -1)
3
3
TARGET_PORT=0
4
4
5
5
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
13
20
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]+' )
15
22
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 }
19
26
fi
20
27
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 } ."
23
30
24
31
exit 0
0 commit comments