Last active
April 12, 2018 17:56
-
-
Save loinguyenduc101/3f36a8b4d35c6b9cd8ca24b3b47b2a83 to your computer and use it in GitHub Desktop.
spring boot application start with jenkins
This file contains hidden or 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/sh | |
#set -e | |
#latest jar | |
jarFile=$(ls ./target/*.jar | sort -r | head -1) | |
echo "===========> Jar File $jarFile" | |
#check and kill process | |
UP=$(pgrep -f $jarFile | wc -l) | |
UP_PID=$(pgrep -f $jarFile) | |
echo "============================> PID [$UP_PID]" | |
[ "$UP" -ne 0 ] && kill -9 $UP_PID | |
# start DEV profile | |
nohup java -Xmx256m -Xss256k -jar $jarFile --spring.profiles.active=dev & | |
echo "============================>STARTED PID $(pgrep -f $jarFile)" | |
### USE | |
### jenkin job --> build --> execute shell | |
## BUILD_ID=dontKillMe sh bootapp.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment