gpt4 book ai didi

ubuntu - 系统错误 "failed to start service: unit service is not loaded properly: exec format error"

转载 作者:太空宇宙 更新时间:2023-11-03 16:49:14 25 4
gpt4 key购买 nike

我可以从 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:

最佳答案

问题不在于 ExecStart,而在于 ExecStopExecReload 部分——它们也需要是绝对的。

最终版本:

[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=/bin/kill -INT $MAINPID
ExecReload=/bin/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 - 系统错误 "failed to start service: unit service is not loaded properly: exec format error",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51858065/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com