1

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?

13
  • Did you try sudo service sickbeard start after update-rc.d command? If yes, did you check if there are log in /var/log/syslog? – Lety Sep 23 '14 at 11:03
  • I can just start the services manually - that works. No sign of sickbeard or sabnzbd in syslog though... – mainstream Sep 23 '14 at 11:16
  • Could you post on pastebin.com sickbeard init script and ls /etc/rc*.d output? – Lety Sep 23 '14 at 11:56
  • Probably script runs on boot, but fails. Could you post /var/log/syslog with all logs issued during boot and namei -mo /var/run/sickbeard/sickbeard.pid commad output? – Lety Sep 23 '14 at 23:30
  • Ok strange, but thanks for the help :) Here's the output: pastebin.com/0ru9fH8r I find it particular strange that they don't start at boot, but they do start with: $ sudo service sickbeard start && sudo service sabnzbdplus start [sudo] password for mainstream: Removing stale /home/mainstream/.sickbeard/pid Starting SickBeard * Starting SABnzbd+ binary newsgrabber [ OK ] – mainstream Sep 24 '14 at 17:58
3

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 .
2
  • I've tried this several times, but still the services won't start. There are not entry's in the /var/log/boot.log so i don't understand what's going wrong here. – mainstream Dec 10 '14 at 18:01
  • oh, it is strange, what happened? on September 25 you wrote that worked. – Lety Dec 11 '14 at 18:36
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.