Created
January 19, 2018 01:06
-
-
Save jeonguk/d8a9f728ccc2000a96305339c6f95a15 to your computer and use it in GitHub Desktop.
spring boot : git pull source -> aws ec2 -> deploy shell script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
REPOSITORY=/home/ec2-user/app/git | |
cd $REPOSITORY/springboot-webservice/ | |
echo "> Git Pull" | |
git pull | |
echo "> Project build start " | |
### maven or gradle ## | |
./mvn build | |
ehco "> Build file copy" | |
cp ./build/libs/*.jar $REPOSITORY/ | |
echo "> Running application pid check" | |
CURRENT_PID=$(pgrep -f springboot-webservice) | |
echo "$CURRENT_PID" | |
if [ -z $CURRENT_PID ]; then | |
echo "> No running application" | |
else | |
echo "> kill -2 $CURRENT_PID" | |
kill -2 $CURRENT_PID | |
sleep 5 | |
fi | |
echo "> New application deploy" | |
JAR_NAME=$(ls $REPOSITORY/ |grep 'springboot-webservice' | tail -n 1) | |
echo "> JAR Name : $JAR_NAME" | |
nohup java -jar $REPOSITORY/$JAR_NAME & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment