Sickbeard and Sabnzbdplus won't start at boot

I seem to have some problems with automating some services at startup. I've had this problem before, but I couldn't find out the exact reason what caused this.

I've added both services to startup with:

$ sudo update-rc.d sickbeard defaults

Then:

$ 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

(list is truncated) Screenshot from jobs-admin:

enter image description here As you can see the app is not starting at boot... What might be causing this?


Solution 1:

Finally we found that sickbeard start at boot, but fails.

In /var/log/boot.log we can see this error:

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

and looking at sickbeard init script:

APP_PATH=${SB_HOME-/opt/sickbeard}

for some reason we do not know, when sickbeard start, /opt is not ready.

As workaround, starting sickbeard later during boot sequence seems fix the issue.


To accomplish this, take a look at /etc/rcX.d folder and remove Sxxsickbeard and Kxxsickbeard files. These are symbolic links to /etc/init.d/sickbeard script.

This script are executed during system boot following the alphabetical order, so using update-rc.d it is possible choose 'when' service start/stop, for example:

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

This will assign S99 (the last possible) for start during system boot and K01 (the first possible) for stop during shutdown or reboot.

In this case, looking at your runlevel, I suggest this configuration:

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

Solution 2:

Ok, i found the problem causing this. Maybe other people encounter the same problem.

My disk is encrypted and thus, is only readable when logged in. All program configurations are in /home/username, so unreadable. This causes the services to malfunction.

A fix i wrote:

#!/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

It'll check whether the folders exist (every 5 seconds) and start the services accordingly. Add it (for example to rc.local). Example 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

Script output:

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