systemd错误“无法启动服务:单元服务未正确加载:exec格式错误”

时间:2018-08-15 11:44:00

标签: ubuntu systemd

我可以从shell中执行确切的ExecStart命令,并且可以运行,但是由于某些原因,在此服务文件中,该命令不起作用-有任何想法吗?

错误:

Failed to start previewapi.service: Unit previewapi.service is not loaded properly: Exec format error.
See system logs and 'systemctl status previewapi.service' for details.

systemd .service文件:

[Unit]
Description = preview-api
After       = network.target

[Service]
WorkingDirectory=/srv/previewapi
ExecStart   = /usr/bin/java -jar /srv/previewapi/gn-preview-api-0.1.0-SNAPSHOT-standalone.jar

ExecStop    = kill -INT $MAINPID
ExecReload  = kill -TERM $MAINPID

# In case if it gets stopped, restart it immediately
Restart     = always

Type        = simple


[Install]
# multi-user.target corresponds to run level 3
# roughtly meaning wanted by system start
WantedBy    = multi-user.target

Ubuntu 18.04。

sudo journalctl -u previewapi说:

Aug 15 10:00:28 ubuntu-bionic systemd[1]: /etc/systemd/system/previewapi.service:18: Executable path is not absolute:

1 个答案:

答案 0 :(得分:3)

问题不是// With tslint@5.0.0+ { "extends": [ "tslint-config-airbnb", "tslint-config-prettier", "tslint-plugin-prettier" ], "rules": { "prettier": true } } // With tslint@5.2.0+ { "extends": [ "tslint-config-airbnb", "tslint-config-prettier", "tslint-plugin-prettier" ], "rules": { "prettier": true }, "rulesDirectory": [ "tslint-plugin-prettier" ] } ,而是ExecStartExecStop部分-它们也必须是绝对的。

最终版本:

ExecReload