我希望运行我的Spring Boot应用程序作为服务我在/etc/systemd/system
[Unit]
Description=Application_Test
After=syslog.target
[Service]
User=jenkins
ExecStart=java -jar /var/myapp/app.war
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
运行此命令:
systemctl enable myapp.service
我开始了
service start myapp
我有这个错误:
Redirecting to /bin/systemctl start myapp.service
Failed to issue method call: Unit myapp.service failed to load: Invalid argument.
有什么问题?
答案 0 :(得分:0)
我忘了在我的脚本中查询JDK的方式
[Unit]
Description=Application_Test
After=syslog.target
[Service]
User=jenkins
ExecStart=/usr/bin/java -jar /var/myapp/app.war
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target