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>

现在一切正常,安装外部驱动器后服务开始

相关内容