shell 管理SpringBoot 生产环境服务
来源:互联网 发布:centos7 更新 PHP 编辑:程序博客网 时间:2024/06/06 04:57
Spring Boot 在生产环境中运行如果是用maven 打包为jar 运行那么再关闭 重启服务这样每次在操作的时候就非常不方便 这里写了个shell 脚本统一管理
# description: Auto-starts bootTag="PublishImageApplication"MainClass="com.yoke.PublishImageApplication"Lib="/test/lib/"Log="/test/run.log"echo $TagRETVAL="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 ;;esacexit $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
阅读全文
0 0
- shell 管理SpringBoot 生产环境服务
- shell 管理SpringBoot 生产环境服务 2
- shell 管理SpringBoot 生产环境服务 (配置JVM)
- shell 管理SpringBoot 生产环境服务 (备份日志)
- springboot 生产环境与开发环境配置
- 生产环境的变更管理
- SpringBoot(六)开发环境/测试环境和生产环境
- 生产环境使用http服务要点
- 实现生产环境的监控&管理
- Spring Boot 监控和管理生产环境
- 将测试环境代码推到预生产环境shell脚本
- .net Core 生产环境 KestrelServer + Shell 实践
- 数据访问更新服务在生产环境部署注意事项
- 生产环境上线程序导致服务故障案例解析
- Nagios监控生产环境redis集群服务实战
- 用webmin管理LNMP生产环境及Linux系统
- golden gate 生产环境的安装部署之管理进程
- 监控和管理生产环境spring boot actuator
- 企业级互联网架构(Aliware)实践
- 初识Redis
- jquery 父、子页面之间页面元素的获取,方法的调用
- Recursion !!! Recursive calls should not address subproblems that overlap !!!
- 工作学习笔记 之UUID
- shell 管理SpringBoot 生产环境服务
- 简单又不简单的产品设计四大原则
- iOS开发永久数据保存方式
- 图片等比例缩放算法
- 数据分析深圳连跌多月房价 为啥华为员工还是买不起房?
- python在不同文件之间共享全局变量方案的探讨
- c++ 静态成员函数和非静态成员函数的区别?
- UI设计师下一步要怎么发展?
- MongoDB的数据库如何备份和恢复?