Solon v3.0.6

借用 systemctl service 管理服务

</> markdown

1、添加 systemctl service 配置,demoapp 为例:/etc/systemd/system/demoapp.service

[Unit]
Description=demoapp
After=syslog.target

[Service]
ExecStart=/usr/bin/java -jar /data/sss/demo/demoapp.jar
SuccessExitStatus=143
SuccessExitStatus=143
Restart=on-failure

[Install]
WantedBy=multi-user.target

2、通过 systemctl 指令操控服务:

systemctl enable demoapp

systemctl restart demoapp

systemctl stop demoapp

配置好后之后,服务更新的简单操作:

  1. 更新 jar 文件
  2. 运行 systemctl restart demoapp 即可