Solon v3.0.3

借用 systemctl service 管理服务

</> markdown

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

[Unit]
Description=waterapi
After=syslog.target

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

[Install]
WantedBy=multi-user.target

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

systemctl enable waterapi

systemctl restart waterapi

systemctl stop waterapi

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

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