ci: 배포를 위한 쉘 스크립트 생성

PID 생성
    war 파일명 지정
dev
Jonguk. Lim 5 months ago
parent 4efe44c4d6
commit 59e5e4525f

@ -82,7 +82,8 @@
<build>
<defaultGoal>install</defaultGoal>
<directory>${basedir}/target</directory>
<finalName>${project.artifactId}-${project.version}</finalName>
<!-- <finalName>${project.artifactId}-${project.version}</finalName>-->
<finalName>${project.name}</finalName>
<resources>
<resource><directory>${basedir}/src/main/resources</directory></resource>

@ -0,0 +1,3 @@
#!/bin/sh
source /applications/adds/bin/stopFo.sh
mv /applications/adds/adds-fo.war /applications/adds/adds-fo.war_backup

@ -0,0 +1,9 @@
#!/bin/bash
echo "======================"
echo "adds-fo application start"
echo "======================"
JAVA_HOME=/lib/jvm/jdk-17.0.2
export JAVA_HOME
LANG=ko_KR.utf8
export LANG
sudo nohup $JAVA_HOME/bin/java -Dspring.profiles.active=prod -jar /applications/adds/adds-fo.war > /dev/null &

@ -0,0 +1,27 @@
#!/bin/sh
#if [ $# -ne 1 ]; then
# echo "-----------------------------------"
# echo " Undefined parameter"
# echo "./stopFo.sh [application name]"
# echo "-----------------------------------"
# exit 1
#fi
PIDS=`ps -ef | grep java | grep adds-fo | awk '{print $2}'`
for PID in $PIDS; do
echo "Process ID: $PID"
done
if [ -z "$PIDS" ]; then
echo "=============================="
echo " No adds-fo deamon is running"
echo "=============================="
else
for PID in $PIDS; do
echo "==============================="
echo "Kill adds-fo[$PID] process"
sudo kill -9 $PID
echo "adds-fo[$PID] application stop"
echo "==============================="
done
fi

@ -1,11 +1,22 @@
package cokr.xit.adds;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.ApplicationPidFileWriter;
import cokr.xit.base.boot.XitBaseApplication;
public class XitBootApplication extends XitBaseApplication {
public static void main(String[] args) {
SpringApplication.run(XitBootApplication.class, args);
//SpringApplication.run(XitBootApplication.class, args);
final SpringApplicationBuilder applicationBuilder = new SpringApplicationBuilder(XitBootApplication.class);
final SpringApplication application = applicationBuilder.build();
application.setBannerMode(Banner.Mode.OFF);
application.setLogStartupInfo(false);
application.addListeners(new ApplicationPidFileWriter( "adds-fo.pid"));
application.run(args);
}
}
}

Loading…
Cancel
Save