Sickbeard 和 Sabnzbdplus 无法在启动时启动

Sickbeard 和 Sabnzbdplus 无法在启动时启动

我似乎在启动时自动执行某些服务时遇到了一些问题。我以前也遇到过这个问题,但我找不到导致这个问题的确切原因。

我已将这两项服务添加到启动中:

$ sudo update-rc.d sickbeard defaults

然后:

$ sudo service sickbeard status
 * sickbeard is not running

$ sudo service sabnzbdplus status
 * SABnzbd+ binary newsgrabber: not running

$ service --status-all 
 [ + ]  acpid
 [ - ]  rsync
 [ + ]  rsyslog
 [ - ]  sabnzbdplus
 [ + ]  saned
 [ ? ]  sendsigs
 [ - ]  sickbeard

(列表被截断)来自 jobs-admin 的屏幕截图:

在此处输入图片描述 如您所见,应用程序并未在启动时启动...这可能是什么原因造成的?

答案1

最后我们发现,虽然sickbeard在开机时启动,但是却失败了。

我们/var/log/boot.log可以看到这个错误:

Starting SickBeard
/usr/bin/python: can't open file 'SickBeard.py': [Errno 2] No such file or directory

并查看sickbeard初始化脚本:

APP_PATH=${SB_HOME-/opt/sickbeard}

由于某种我们不知道的原因,何时sickbeard开始,/opt还没有准备好。

作为解决方法,sickbeard在启动过程中稍后启动似乎可以解决问题。


为了实现这一点,请查看/etc/rcX.d文件夹并删除SxxsickbeardKxxsickbeard文件。这些是脚本的符号链接/etc/init.d/sickbeard

该脚本在系统启动时按照字母顺序执行,因此使用update-rc.d它可以选择“何时”启动/停止服务,例如:

   update-rc.d sickbeard start 99 2 3 4 5 . stop 01 0 1 6 .

这将在系统启动期间分配S99(最后一个可能的) ,并在关机或重启期间分配(第一个可能的) 。startK01stop

在这种情况下,看看你的运行级别,我建议这样的配置:

   update-rc.d sickbeard start 06 2 3 4 5 . stop 01 0 1 6 .

答案2

好的,我找到了导致此问题的原因。也许其他人也遇到了同样的问题。

我的磁盘已加密,因此只有登录后才可读取。所有程序配置都在 /home/username 中,因此不可读取。这导致服务出现故障。

我写的修复程序:

#!/bin/bash -vx
DIR=/home/mainstream/.sabnzbd

sleep 10

function checkdir() {
if [ ! -d "$DIR" ];
then
   echo "File $DIR doesn't exist yet"
   sleep 5 && checkdir #loop to check if directory is ready
else
   echo "Directory $DIR exists"
   /etc/init.d/sabnzbdplus start && /etc/init.d/sickbeard start  && /etc/init.d/autosub start && /etc/init.d/couchpotatov2 start
fi
}

checkdir

它会检查文件夹是否存在(每 5 秒一次)并相应地启动服务。添加它(例如添加到 rc.local)。示例 rc.local:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sleep 10
exec 2> /tmp/rc.local.log  # send stderr from rc.local to a log file
exec 1>&2                      # send stdout to the same log file
set -x                         # tell sh to display commands before execution
#/home/mainstream/.startup.sh
/opt/startup.sh

exit 0

脚本输出:

checkdir
+ checkdir
+ '[' '!' -d /home/mainstream/.sabnzbd ']'
+ echo 'File /home/mainstream/.sabnzbd doesn'\''t exist yet'
File /home/mainstream/.sabnzbd doesn't exist yet
+ sleep 5
+ checkdir
+ '[' '!' -d /home/mainstream/.sabnzbd ']'
+ echo 'File /home/mainstream/.sabnzbd doesn'\''t exist yet'
File /home/mainstream/.sabnzbd doesn't exist yet
+ sleep 5
+ checkdir
+ '[' '!' -d /home/mainstream/.sabnzbd ']'
+ echo 'File /home/mainstream/.sabnzbd doesn'\''t exist yet'
File /home/mainstream/.sabnzbd doesn't exist yet
+ sleep 5
+ checkdir
+ '[' '!' -d /home/mainstream/.sabnzbd ']'
+ echo 'Directory /home/mainstream/.sabnzbd exists'
Directory /home/mainstream/.sabnzbd exists
+ /etc/init.d/sabnzbdplus start
 * Starting SABnzbd+ binary newsgrabber
   ...done.
+ /etc/init.d/sickbeard start
 * Starting SickBeard
   ...done.
+ /etc/init.d/autosub start
Starting AutoSub
AutoSub: Initializing variables and loading config
AutoSub: Starting as a daemon
AutoSub: Initializing variables and loading config
AutoSub: Starting as a daemon
AutoSub: Initializing variables and loading config
AutoSub: Starting as a daemon
AutoSub: Disabling console output for daemon.
+ /etc/init.d/couchpotatov2 start
 * Starting CouchPotatoV2
   ...done.

+ exit 0

相关内容