반응형
vi deploy.sh
#!/bin/bash
HOME='/home/service/cashcow'
SPRING_PROFILE='prod'
BUILD_YN='true'
if [ -z "$SPRING_PROFILE" ]; then
echo "SPRING_PROFILE is empty"
SPRING_PROFILE="stg"
fi
cd $HOME
sleep 1;
chmod 700 $HOME/gradlew
cp deploy.sh ../
pwd
if [ $BUILD_YN = 'true' ]; then
echo 'git pull start'
sleep 1;
git checkout -b temp
sleep 1;
git branch -D master
sleep 1;
git checkout master
sleep 1;
git branch -D temp
sleep 1;
git pull origin master
sleep 1;
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
반응형
댓글