簡易システムサービスエラー

簡易システムサービスエラー

次のシステムサービスがあります。

$ sudo猫/etc/systemd/system/my_service123.service

    [Unit]
    Description=my_service123
    After=syslog.target

    [Service]
    ExecStart=./my_app --config main_cfg.conf
    Restart=on-abort
    WorkingDirectory=/home/user1/my_service_workspace
    SyslogIdentifier=my_service123
    User=user1

    [Install]
    WantedBy=multi-user.target

私がそれを実行したとき:

Failed to start my_service123.service: Unit my_service123.service has a bad unit file setting.
See system logs and 'systemctl status my_service123.service' for details.

しかし、

$ sudo journalctl -u my_service123
No journal files were found.
-- No entries --

何の問題がありますか?

$ sudo systemctl status my_service123
● my_service123.service - ton-node_01
     Loaded: bad-setting (Reason: Unit my_service123.service has a bad unit file setting.)
     Active: inactive (dead)

ベストアンサー1

見てくださいsystemctl status my_service123.service。出力には次の内容が表示されます。

Mar 04 14:39:02 hostname systemd[1]: /etc/systemd/system/my_service123.service:5: Neither a valid executable name nor an absolute path: <path>

絶対パスを試してみると正常に動作します。

おすすめ記事