운영체제 이야기/Linux(CentOS)
[CentOS7] 간단 배포 스크립트
한희성
2023. 10. 13. 23:53
반응형
#!/bin/bash
SPRING_PROFILE=$1
BUILD_YN=$2
if [ -z "$SPRING_PROFILE" ]; then
echo "SPRING_PROFILE is empty"
SPRING_PROFILE="stg"
fi
cd 프로젝트 경로
if [ $BUILD_YN = 'true' ]; then
echo 'git pull start'
git pull
echo 'git pull end'
fi
sleep 1
PID=$(cat application.pid)
echo "PID => $PID"
sleep 1
kill -9 $PID
sleep 1
./gradlew build -x test
sleep 1
cd build/libs
sleep 1
/usr/bin/nohup java -Dlog4j2.formatMsgNoLookups=true -jar demo_project-0.0.1-SNAPSHOT.jar --spring.profiles.active=$SPRING_PROFILE > ../../nohup.log 2>&1 &
sleep 1
cd ../../
sleep 1
반응형