3

現在、Ubuntu サーバーの電源が入ったときに Luigid を起動しようとしています。rc.local、cronjob(@reboot)、upstart、systemd などのいくつかの手法を試しましたが、どれも機能していないようです。

手動でコマンドを実行すると、コマンドが正常に実行されることを指摘する必要があります。起動時に実行する必要があるだけです。この時点で、どの方法で機能させるかについてはまったく心配していないので、私が試したことのいくつかを以下に示します-

クロン:

使用済み

sudo crontab -e

そして入った

@reboot luigid --background --logdir /home/myuser/luigilog

システムド:

/usr/bin に次の内容の luigid というスクリプトがあり、実行可能としてマークされています。適切な終了コードが必要になる可能性があることを恐れて、「exit 0」の有無にかかわらず試しました-

#!/bin/sh
exec luigid --background --logdir /home/myuser/luigilog

luigid.service という /etc/systemd/system/ のサービスファイル -

[Unit]
Description=Luigid Service

[Service]
Type=forking
ExecStart=/usr/bin/luigid

[Install]
WantedBy=multi-user.target

私は forking を試みました(そして、サービスと lugid コマンドの両方で PIDfile を指定しました。ワンショットで単純なタイプとして運がありませんでした。

を使用してサービスを有効にしました -

systemctl enable luigid.service

を使用してステータスを確認するため、サービスを開始しようとしているようです

systemctl status luigid.service

ショー

luigid.service - Luigid Service
   Loaded: loaded (/etc/systemd/system/luigid.service; enabled; vendor preset: enabled)
   Active: failed (Result: timeout) since Mon 2016-10-10 15:18:00 UTC; 18min ago

Oct 10 15:16:29 Analytics systemd[1]: Starting Luigid Service...
Oct 10 15:18:00 Analytics systemd[1]: luigid.service: Start operation timed out. Terminating.
Oct 10 15:18:00 Analytics systemd[1]: Failed to start Luigid Service.
Oct 10 15:18:00 Analytics systemd[1]: luigid.service: Unit entered failed state.
Oct 10 15:18:00 Analytics systemd[1]: luigid.service: Failed with result 'timeout'.

私が見逃している明らかな何かがあるに違いありません。起動時にコマンドを実行するのはそれほど難しいことではありません!

4

1 に答える 1