起動時にsystemdサービスが開始されない

起動時にsystemdサービスが開始されない

Debian Jessie ボックスを再起動するたびに NZBget は起動しません。すでに有効になっていますsudo systemctl enable nzbget

私がするなら:

$ sudo systemctl status nzbget
* nzbget.service - NZBGet
Loaded: loaded (/etc/systemd/system/nzbget.service; enabled)
Active: inactive (dead) since Sat 2016-02-20 12:14:55 GMT; 1min 15s ago
Process: 381 ExecStop=/opt/nzbget/nzbget -Q (code=exited,status=0/SUCCESS)
Process: 263 ExecStart=/opt/nzbget/nzbget -D (code=exited, status=0/SUCCESS)

そうすればsudo system start nzbget始まります。

サービスファイルですsudo nano /etc/systemd/system/nzbget.service

[Unit]
Description=NZBGet
After=network.target
RequiresMountsFor=/<pathtomount>

[Service]
User=osmc
Group=osmc
ExecStart=/opt/nzbget/nzbget -D
ExecStop=/opt/nzbget/nzbget -Q

# process will demonize and parent return ok
Type=forking
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure

[Install]
# Needed to run nzbget at boot
WantedBy=multi-user.target

この問題に関する提案

 -- Logs begin at Sat 2016-02-20 12:31:40 GMT, end at Sun 2016-02-21 10:53:14 GMT. --
Feb 20 12:31:43 osmc nzbget[279]: /home/osmc/Downloads/nzbget.log: No such file or directory
Feb 20 12:31:43 osmc nzbget[279]: /home/osmc/Downloads/nzbget.log: No such file or directory
Feb 20 12:31:43 osmc nzbget[279]: /home/osmc/Downloads/nzbget.log: No such file or directory
Feb 20 12:31:43 osmc nzbget[279]: /home/osmc/Downloads/nzbget.log: No such file or directory
Feb 20 12:31:43 osmc nzbget[279]: nzbget.conf(70): Invalid value for option "TempDir" (/home/osmc/Downloads/tmp/): could not read information for dir
Feb 20 12:31:43 osmc nzbget[279]: nzbget.conf(67): Invalid value for option "QueueDir" (/home/osmc/Downloads/queue/): could not read information for 
Feb 20 12:31:43 osmc nzbget[279]: nzbget.conf(61): Invalid value for option "NzbDir" (/home/osmc/Downloads/nzb/): could not read information for dire
Feb 20 12:31:43 osmc nzbget[391]: /home/osmc/Downloads/nzbget.log: No such file or directory
Feb 20 12:31:43 osmc nzbget[391]: /home/osmc/Downloads/nzbget.log: No such file or directory
Feb 20 12:31:43 osmc nzbget[391]: /home/osmc/Downloads/nzbget.log: No such file or directory
Feb 20 12:31:43 osmc nzbget[391]: nzbget.conf(70): Invalid value for option "TempDir" (/home/osmc/Downloads/tmp/): could not read information for dir
Feb 20 12:31:43 osmc nzbget[391]: nzbget.conf(67): Invalid value for option "QueueDir" (/home/osmc/Downloads/queue/): could not read information for 
Feb 20 12:31:43 osmc nzbget[391]: nzbget.conf(61): Invalid value for option "NzbDir" (/home/osmc/Downloads/nzb/): could not read information for dire
Feb 20 12:31:43 osmc nzbget[391]: Unable to send request to nzbget-server at 127.0.0.1 (port 6789)

ベストアンサー1

上記の編集をご覧ください。 [unit]セクションには以下が必要です。 RequiresMountsFor=/<pathtomount>

これで、すべてがうまく機能し、外付けドライブを取り付けた後、サービスが開始されます。

おすすめ記事