Friday, April 26, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 3477  / 1 Year ago, thu, may 11, 2023, 8:38:02

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?


More From » startup

 Answers
4

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

[#23104] Saturday, May 13, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
uxuriousrnal

Total Points: 279
Total Questions: 106
Total Answers: 96

Location: Fiji
Member since Wed, Mar 29, 2023
1 Year ago
uxuriousrnal questions
Wed, Mar 9, 22, 09:04, 2 Years ago
Mon, Jul 18, 22, 01:48, 2 Years ago
Wed, Apr 13, 22, 01:15, 2 Years ago
Thu, Aug 26, 21, 22:01, 3 Years ago
;