环境部署

步骤
在linux下创建自定义service服务
1、在/etc/systemd/system目录下新建test.service 文件

执行脚本

[Unit]
Description=EHR Service
Documentation=EHR
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=/usr/local/jdk-11.0.12/bin/java -jar /www/be/test-be/test.jar --spring.profiles.active=prod --mpw.key=123456
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=always
WorkingDirectory=/www/be/test-be

[Install]
WantedBy=multi-user.target

记录

启动:systemctl start my-demo.service
结束:systemctl stop my-demo.service
重启:systemctl restart my-demo.service
状态:systemctl statu my-demo.service
查看服务状态: systemctl status network.service
列出所有可用单元:systemctl list-unit-files
列出所有运行中单元:systemctl list-units
列出所有失败单元:systemctl --failed
使用systemctl命令杀死服务:systemctl kill network.service

results matching ""

    No results matching ""