Ok, achei o problema causando isso. Talvez outras pessoas encontrem o mesmo problema.
Meu disco é criptografado e, portanto, só é legível quando conectado. Todas as configurações do programa estão em / home / username, portanto, ilegíveis. Isso faz com que os serviços funcionem mal.
Uma correção que escrevi:
#!/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
Verifica se as pastas existem (a cada 5 segundos) e inicia os serviços de acordo. Adicione-o (por exemplo, a rc.local). Exemplo 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
Saída de script:
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