Last active
May 11, 2016 14:33
-
-
Save didyhu/336e2204128294eb4547 to your computer and use it in GitHub Desktop.
scripts to run spring boot application
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 | |
stop(){ | |
for pid in $(ps aux | grep 'java' | grep -v 'grep' | awk '{print $2}') | |
do | |
pwd=$(pwd); | |
cwd=$(readlink /proc/$pid/cwd) | |
if [ ${cwd} -ef ${pwd} ] | |
then | |
echo "killing $pid @ $pwd" | |
kill $pid | |
fi | |
done | |
} | |
start(){ | |
(java -cp target org.springframework.boot.loader.JarLauncher &) | |
} | |
status(){ | |
for pid in $(ps aux | grep 'java' | grep -v 'grep' | awk '{print $2}') | |
do | |
pwd=$(pwd); | |
cwd=$(readlink /proc/$pid/cwd) | |
if [ ${cwd} -ef ${pwd} ] | |
then | |
echo "status of $pid @ $pwd" | |
ps aux | grep $pid | grep -v "grep" | |
fi | |
done | |
} | |
case "$1" in | |
start) start ;; | |
stop) stop ;; | |
restart) | |
stop | |
start | |
;; | |
status) status ;; | |
*) | |
echo "Usage: $0 start|stop|restart|status" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment