운영체제 이야기/Linux(CentOS)

[CentOS7] 간단 배포 쉘

한희성 2023. 10. 30.
반응형
#!/bin/bash

HOME='프로젝트 경로'
SPRING_PROFILE='prod'
BUILD_YN='false'
if [ -z "$SPRING_PROFILE" ]; then
    echo "SPRING_PROFILE is empty"
    SPRING_PROFILE="stg"
fi

cd $HOME
pwd

if [ $BUILD_YN = 'true' ]; then
        echo 'git pull start'
        git pull
        echo 'git pull end'
fi

sleep 1

PID=$(cat ./pid/application.pid)

echo "PID => $PID"

sleep 1

kill -9 $PID

sleep 1

rm -rf ./build

sleep 1

./gradlew build -x test

sleep 1

JAR_NAME=$(ls $HOME/build/libs/ -l | grep jar | head -1)
/usr/bin/nohup java -Dlog4j2.formatMsgNoLookups=true -jar $HOME/build/libs/*.jar --spring.profiles.active=$SPRING_PROFILE > ./nohup.log 2>&1 &

sleep 1

tail -F ./nohup.log
반응형

댓글

💲 추천 글