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
原文:http://www.cnblogs.com/chengjunhao/p/7771801.html