1.获取jar包权限
chmod 500 your-app.jar
2.新建service文件:/etc/systemd/system/myapp.service
[Unit] Description=myapp After=syslog.target [Service] User=myapp ExecStart=/var/myapp/myapp.jar SuccessExitStatus=143 [Install] WantedBy=multi-user.target
3.启用systemctl enable myapp.service
4.systemctl start myapp.service
时间: 2024-10-10 00:04:25