Spring Boot 在生产环境中运行如果是用maven 打包为jar 运行那么再关闭 重启服务这样每次在操作的时候就非常不方便 这里写了个shell 脚本统一管理
# description: Auto-starts boot Tag="PublishImageApplication" MainClass="com.yoke.PublishImageApplication" Lib="/test/lib/" Log="/test/run.log" echo $Tag RETVAL="0" # See how we were called. function start() { echo $Log if [ ! -f $Log ]; then touch $Log fi nohup java -Dappliction=$Tag -Djava.ext.dirs=$Lib":${JAVA_HOME}/jre/lib/ext" $MainClass > $Log 2>&1 & tailf $Log } function stop() { pid=$(ps -ef | grep -v 'grep' | egrep $Tag| awk '{printf $2 " "}') if [ "$pid" != "" ]; then echo -n "boot ( pid $pid) is running" echo echo -n $"Shutting down boot: " pid=$(ps -ef | grep -v 'grep' | egrep $Tag| awk '{printf $2 " "}') if [ "$pid" != "" ]; then echo "kill boot process" kill -9 "$pid" fi else echo "boot is stopped" fi status } function status() { pid=$(ps -ef | grep -v 'grep' | egrep $Tag| awk '{printf $2 " "}') #echo "$pid" if [ "$pid" != "" ]; then echo "boot is running,pid is $pid" else echo "boot is stopped" fi } function usage() { echo "Usage: $0 {start|stop|restart|status}" RETVAL="2" } # See how we were called. RETVAL="0" case "$1" in start) start ;; stop) stop ;; restart) stop start ;; reload) RETVAL="3" ;; status) status ;; *) usage ;; esac exit $RETVAL
Tag: 在中起着标识程序运行标志,如果服务器运行多个java 程序需用java 的 -Dappliction 来区分对应程序
MainClass: 是对应程序的运行的SpringBoot main 类
Lib:是boot程序在生产服务器环境中的所有jar 路径
Log:是记录boot程序运行所有日志保存路径
如脚本在
/boot/run_boot.sh
启动命令: /boot/run_boot.sh start
重启命令: /boot/run_boot.sh restart
关闭命令: /boot/run_boot.sh stop
是否运行: /boot/run_boot.sh status
文章来源:http://blog.csdn.net/jiangzeyin_/article/details/74671334
相关推荐
Shell 脚本,springboot Linux服务部署脚本。将springboot打好的wrapper包部署的Linux服务器上。完成旧版本备份和配置文件替换,自动部署并重启服务。
sqlite-shell-win32-x86-3080200.zip sqlite的windows版本
最新SpringBoot框架后台管理模板 本SpringBoot框架采用零xml配置,全部动态启动、支持热部署 框架结构清晰明了! 框架管理:maven 框架: 1.核心框架---------Spring-boot 2.数据源框架-------mybatis、HikariCP...
csapp-shell-labcsapp-shell-labcsapp-shell-labcsapp-shell-labcsapp-shell-labcsapp-shell-labcsapp-shell-labcsapp-shell-labcsapp-shell-labcsapp-shell-labcsapp-shell-labcsapp-shell-labcsapp-shell-labcsapp...
前言:打包好的springboot项目,可以使用java -jar xxx.jar的方式启动。当出现多个springboot项目需要启动的时候,可以使用脚本启动的方式。这在springcloud项目的开发测试阶段尤为有用。以下展示启动脚本示例,过程...
mysql-shell-8.0.18-windows-x86-64bit.zip MySQL Shell is an advanced command-line client and code editor for MySQL. In addition to SQL, MySQL Shell also offers scripting capabilities for JavaScript ...
网上可以下到sqlite-shell-win32-x86: sqlite3.exe 2. 为了方便命令行执行,将sqlite3.exe放到svn 项目的主目录下,和.svn目录同级下。 3. 执行 sqlite3 .svn/wc.db "select * from work_queue".看到有4条记录。就是...
sqlite-shell-win32-x86-3071602.zip
Shell脚本,springboot服务器日志清空脚本,清空服务器上logs下所有*.log结尾的日志文件。
入门相依性< dependency> < groupId>com.github.fonimus</ groupId> < artifactId>ssh-shell-spring-boot-starter</ artifactId></ dependency> 注意:自动配置SshShellAutoConfiguration (默认情况下处于活动...
13_questions_of_shell, shell十三问--shell教程(markdown 版本)
Linux运维-3.Shell编程-11shell基础-112环境变量3.avi
Linux运维-3.Shell编程-11shell基础-111环境变量2.avi
Linux运维-3.Shell编程-11shell基础-110环境变量1.avi
最新的sqlite3 下载方便在win上面使用 sqlite-shell-win32-x86-3080403
Linux运维-3.Shell编程-11shell基础-121环境变量配置文件1.avi
10.3.1 Shell基础-Bash基本功能-历史命令与补全.mp4 10.3.2 Shell基础-Bash基本功能-别名与快捷键.mp4 10.3.3 Shell基础-Bash基本功能-输入输出...10.6.3 Shell基础-环境变量配置文件-其他配置文件和登录信息.mp4
spring-shell-1.1.0.RC1-dist