1.创建 tender.service文件
cd /etc/systemd/system
vim tender.service
查看jdk配置地址
cat /etc/profile
内容
[Unit]
Description=scdykj-iot-mqtt-modbus-61850
After=syslog.target network.target
[Service]
WorkingDirectory=/root/app/scdykj-iot-mqtt-modbus-61850/
ExecStart=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/bin/java -jar /root/app/scdykj-iot-mqtt-modbus-61850/scdykj-iot-mqtt-modbus-61850.jar
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
2、启动程序
systemctl start scdykj-iot-mqtt-modbus-61850.serv