centos7下systemctl管理springboot微服务的基础配置
来源:互联网 发布:php require once use 编辑:程序博客网 时间:2024/06/05 11:34
一. 关于systemctl的基本命令参考:http://www.ruanyifeng.com/blog/2016/03/systemd-tutorial-part-two.html
二. 写service配置,两种方式:设定working目录,springboot会在working目录下寻找application.yml加载;不设定working目录,指定springboot配置文件
2.1 设定working目录:
vi /lib/systemd/system/test.service
[Unit]Description=test [Service]WorkingDirectory=/usr/local/testPrivateTmp=trueRestart=alwaysType=simpleExecStart=/usr/local/java/jdk1.8.0_101/bin/java -jar /usr/local/test/test.jarExecStop=/usr/bin/kill -15 $MAINPID[Install]WantedBy=multi-user.target
2.2 指定springboot配置文件目录
[Unit]Description=test [Service]WorkingDirectory=/usr/local/testPrivateTmp=trueRestart=alwaysType=simpleExecStart=/usr/local/java/jdk1.8.0_101/bin/java -jar /usr/local/test/test.jar --spring.config.location=/usr/local/test/application.ymlExecStop=/usr/bin/kill -15 $MAINPID[Install]WantedBy=multi-user.target
三. systemctl 管理,让配置生效。若是修改配置文件,需要reload:
sudo systemctl daemon-reload
sudo systemctl enable test.service
启动服务
systemctl start test
systemd官方文档: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Services.html
阅读全文
1 0
- centos7下systemctl管理springboot微服务的基础配置
- centos7 使用systemctl管理tomcat9
- Centos7下的systemctl命令与service和chkconfig
- Centos7下的systemctl命令与service和chkconfig
- Centos7下的systemctl命令与service和chkconfig
- CentOS-7 下 systemctl 管理 mysql-5.7的不同,配置jemalloc
- CentOS7中systemctl的使用
- CentOS7中systemctl的使用
- CentOS7中systemctl的使用
- CentOS7中systemctl的使用
- 基于SpringBoot的微服务架构实践
- SpringBoot--5分钟搭建的微服务
- CentOS7 下配置svn的安装及基础配置介绍
- centos7服务管理组件systemctl的服务存贮目录和常用列表命令
- centos7服务管理组件systemctl的服务存贮目录和常用列表命令
- centos7透过systemctl管理不同操作环境——init级别的切换
- springboot微服务
- springboot构建微服务
- Unity自定义UI组件(三)饼图篇
- 求二进制数中的1的个数
- swift中的!和?作用
- 高效javascript编程必知的5个数组方法
- 关于springboot的RestFul的PUT请求,前台参数接收问题
- centos7下systemctl管理springboot微服务的基础配置
- 01分数规划
- After RAC ONE NODE Failover and relocate ,instance_number 和 oracle_sid changes
- 编写第一个基于 mybaits测试实例
- androidexternal目录下新增一个可执行应用及编译
- springboot【6】web开发之异常处理
- Unity自定义UI组件(四)双击按钮、长按按钮
- 《Java设计模式之迭代器模式》
- Android Studio AVD更改路径后,无法启动