创建Systemd服务错误

时间:2017-04-07 15:07:17

标签: linux go systemd

我已经使用golang创建了一个在后台默默运行的小程序,可以通过输入./my_app

运行该程序

它位于$ HOME / my_app / my_app

我继续编写了一个systemd my_app.service文件:

[Unit]
Description="My Test Service"

[Service]
Type=simple
ExecStart= ~/my_app/my_app

[Install]
WantedBy=multi-user.target

然而,当我运行sudo systemctl启动my_app.service时,它出错并返回

Failed to start my_app.service: Unit my_app.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status my_app.service' for details.

systemctl status my_app.service返回

Apr 07 10:15:47 DEV-Rohan systemd[1]: Starting My Test App...
Apr 07 10:15:47 DEV-Rohan systemd[1]: Started My Test App.
Apr 07 10:36:34 DEV-Rohan systemd[1]: [/etc/systemd/system/my_app.service:6]    Executable path is not abs
Apr 07 10:36:34 DEV-Rohan systemd[1]: my_app.service: Service lacks both ExecStart= and ExecStop= setti
Apr 07 11:00:39 DEV-Rohan systemd[1]: [/etc/systemd/system/my_app.service:6] Executable path is not abs
Apr 07 11:00:39 DEV-Rohan systemd[1]: my_app.service: Service lacks both ExecStart= and ExecStop= setti

0 个答案:

没有答案