Skip to content

Instantly share code, notes, and snippets.

@loinguyenduc101
Last active April 12, 2018 17:56
Show Gist options
  • Save loinguyenduc101/3f36a8b4d35c6b9cd8ca24b3b47b2a83 to your computer and use it in GitHub Desktop.
Save loinguyenduc101/3f36a8b4d35c6b9cd8ca24b3b47b2a83 to your computer and use it in GitHub Desktop.
spring boot application start with jenkins
#!/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