How does Linux start, stop and restart the springboot jar package
This article mainly explains "how Linux starts and stops restarting the springboot jar package". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how Linux starts and stops restarting the springboot jar package".
#! / bin/bash # can be replaced with your own execution program here, and other codes do not need to change the APP_NAME=mis-center-soa.jar # instructions to prompt the input parameter usage () {echo "Usage: sh my.sh [start | stop | restart | status]" exit 1} # check whether the program is running is_exist () {pid= `ps-ef | grep $APP_NAME | grep-v grep | awk'{print $2}'`# return 1 if it does not exist Return 0 if [- z "${pid}"] Then return 1 else return 0 fi} # Startup method start () {is_exist if [$?-eq "0]; then echo" ${APP_NAME} is already running. Pid=$ {pid}. " Else nohup java-jar / opt/app/spring-boot/mis-center-soa/$APP_NAME > / opt/logs/my.log 2 > & 1 & echo "${APP_NAME} start success" fi} # stop method stop () {is_exist if [$?-eq "0]; then kill-9$ pid else echo" ${APP_NAME} is not running "fi} # output running status status () {is_exist if [$?-eq" 0] Then echo "${APP_NAME} is running. Pid is ${pid} "else echo" ${APP_NAME} is NOT running. " Fi} # restart restart () {stop start} # according to the input parameters, select to execute the corresponding method. If you do not enter, execute the instructions case "$1" in "start") start;; "stop") stop;; "status") status;; "restart") restart;; *) usage;; esac
Thank you for reading, the above is the content of "how Linux starts and stops restarting springboot jar package". After the study of this article, I believe you have a deeper understanding of the problem of how Linux starts and stops restarting springboot jar package, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!