Skip to content

Instantly share code, notes, and snippets.

@didyhu
Created February 1, 2016 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save didyhu/542db824d9fbbb308db0 to your computer and use it in GitHub Desktop.
Save didyhu/542db824d9fbbb308db0 to your computer and use it in GitHub Desktop.
spring-boot
#!/bin/bash
TARGET=PATHTOTHEJARORWAR.war
start(){
(java -jar $TARGET &)
}
stop(){
PID=$(status | awk '{ print $2 }')
if [ -z "$PID" ]
then
echo "Application is already stopped"
else
echo "killing: $PID"
kill $PID
fi
}
status(){
ps -ef | grep "$TARGET" | grep -v grep
}
case "$1" in
start) start ;;
stop) stop ;;
restart)
stop
start
;;
status) status ;;
*) echo "usage: $0 start|stop|restart"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment