ci: 배포 쉘스트립트 반영

PID 이름 변경
dev
Jonguk. Lim 5 months ago
parent 1572b780ed
commit 3142aa48f7

@ -8,7 +8,7 @@
> adds-api 서버 stop 및 backup
```shell
$ ./backupApi.sh adds-api
$ ./backupApi.sh
```
### 2. application upload
@ -24,7 +24,7 @@ $ ./backupApi.sh adds-api
> adds-api.jar 파일 업로드
```shell
$ ./deployApi.sh adds-api
$ ./deployApi.sh
```
### 4. application run
@ -32,7 +32,7 @@ $ ./deployApi.sh adds-api
> adds-api 서버 start
```shell
$ ./startApi.sh adds-api
$ ./startApi.sh
```
### shell script 실행시 에러 조치

@ -1,22 +1,22 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo "-----------------------------------"
echo " Undefined parameter"
echo "./backupApi.sh [application name]"
echo "-----------------------------------"
exit 1
fi
#if [ $# -ne 1 ]; then
# echo "-----------------------------------"
# echo " Undefined parameter"
# echo "./backupApi.sh [application name]"
# echo "-----------------------------------"
# exit 1
#fi
#
#if [ ! -f "../$1.jar" ]; then
# echo "==================================="
# echo " $1.jar file not exist"
# echo "==================================="
# exit 1
#fi
if [ ! -f "../$1.jar" ]; then
echo "==================================="
echo " $1.jar file not exist"
echo "==================================="
exit 1
fi
source /applications/adds/bin/stopApi.sh $1
source /applications/adds/bin/stopApi.sh
echo "-----------------------------------"
echo " $1 application backup success!"
echo " adds-api application backup success!"
echo "-----------------------------------"
mv /applications/adds/$1.jar /applications/adds/$1.jar_backup
mv /applications/adds/adds-api.jar /applications/adds/adds-api.jar_backup

@ -14,6 +14,5 @@ if [ ! -f "../$1.jar" ]; then
exit 1
fi
source /applications/adds/bin/stopApi.sh $1
mv /applications/adds/$1.jar /applications/adds/$1.jar_backup
cp /var/lib/jenkins/workspace/ADDS-API/adds-api/target/$1.jar /applications/adds/$1.jar

@ -1,23 +1,23 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo "-----------------------------------"
echo " Undefined parameter"
echo "./startApi.sh [application name]"
echo "-----------------------------------"
exit 1
fi
if [ ! -f "../$1.jar" ]; then
echo "==================================="
echo " $1.jar file not exist"
echo "==================================="
exit 1
fi
#if [ $# -ne 1 ]; then
# echo "-----------------------------------"
# echo " Undefined parameter"
# echo "./startApi.sh [application name]"
# echo "-----------------------------------"
# exit 1
#fi
#
#if [ ! -f "../$1.jar" ]; then
# echo "==================================="
# echo " $1.jar file not exist"
# echo "==================================="
# exit 1
#fi
#
echo "================================"
echo " $1 application start"
echo " adds-api application start"
echo "================================"
JAVA_HOME=/lib/jvm/jdk-17.0.2
export JAVA_HOME
nohup $JAVA_HOME/bin/java -Dspring.profiles.active=prod -jar /applications/adds/$1.jar > /dev/null &
nohup $JAVA_HOME/bin/java -Dspring.profiles.active=prod -jar /applications/adds/adds-api.jar > /dev/null &

@ -1,22 +1,22 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo "-----------------------------------"
echo " Undefined parameter"
echo "./stopApi.sh [application name]"
echo "-----------------------------------"
exit 1
fi
#if [ $# -ne 1 ]; then
# echo "-----------------------------------"
# echo " Undefined parameter"
# echo "./stopApi.sh [application name]"
# echo "-----------------------------------"
# exit 1
#fi
PID=`ps -ef | grep java | grep $1 | awk '{print $2}'`
PID=`ps -ef | grep java | grep adds-api | awk '{print $2}'`
echo "Process ID: $PID"
if [ -z $PID ]; then
echo "=============================="
echo " No $1 deamon is running"
echo " No adds-api deamon is running"
echo "=============================="
else
echo "Kill $1[$PID] process"
echo "Kill adds-api[$PID] process"
kill $PID
echo "==============================="
echo " $1[$PID] application stop"
echo " adds-api[$PID] application stop"
echo "==============================="
fi

@ -37,7 +37,6 @@ import lombok.extern.slf4j.Slf4j;
TransactionConfig.class
})
public class XitAddsApplication {
static final List<String> basePackages = new ArrayList<>(
Arrays.asList("egovframework", "kr.xit")
);
@ -70,7 +69,7 @@ public class XitAddsApplication {
//TODO : 이벤트 실행 시점이 Application context 실행 이전인 경우 리스너 추가
//PID(Process ID 작성)
application.addListeners(new ApplicationPidFileWriter()) ;
application.addListeners(new ApplicationPidFileWriter("adds-api.pid"));
application.run(args);
log.info("=========================================================================================");

Loading…
Cancel
Save