SickRage autostart

Status
Not open for further replies.

FlyingPersian

Patron
Joined
Jan 27, 2014
Messages
237
Hi
I installed SickRage via git (https://github.com/SickRage/SickRage.git) and I'm now trying to figure out how to autostart it on startup as the user media, which I had to create manually. I tried the following three things:

1. Add this line to /etc/rc.conf:
Code:
sickrage_enable="YES"


2. Add this line to crontab of the user media:
Code:
@reboot python /media/SickRage/SickBeard.py


3. Add the following script with this line to crontab of the user media:
crontab
Code:
@reboot /bin/sh /media/sickrage.sh


Script
Code:
#!/bin/sh
#start SickRage
python /media/SickRage/SickBeard.py


This is the output of /var/log/cron:
Code:
Jan 22 03:16:55 SickRage /usr/sbin/cron[23175]: (CRON) WARNING (madvise() failed)
Jan 22 03:16:55 SickRage /usr/sbin/cron[23179]: (media) CMD (/bin/sh /media/sickrage.sh)


Running the script manually works. None of the three methods worked so far. Any ideas what else I could do?
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
when you type
Code:
service sickrage start

what happens?
 

Nucshuco

Explorer
Joined
Aug 22, 2014
Messages
52
This is how I did it
create new jail sickrage
jexec into the jail
pkg upgrade
pkg install sabnzbdplus (not sure exactly what i needed so i installed it)
mkdir /usr/local/share/sickrage
chmod -R 777 /usr/local/share/sickrage
mkdir /var/run/sickrage
chmod -R 777 /var/run/sickrage
mkdir /var/db/sickrage
chmod -R 777 /var/db/sickrage
cd /usr/local/share/sickrage
git clone https://github.com/SickRage/SickRage.git
chown -R media:media SickRage
touch /usr/local/etc/rc.d/sickrage copy startup script and paste into /usr/local/etc/rc.d/sickrage
Code:
#!/bin/sh
#
# PROVIDE: sickrage
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# sickrage_enable (bool):    Set to NO by default.
#            Set it to YES to enable it.
# sickrage_user:    The user account sickrage daemon runs as what
#            you want it to be. It uses 'media' user by
#            default. Do not sets it as empty or it will run
#            as root.
# sickrage_group:    The group account sickrage daemon runs as what
#            you want it to be. It uses 'media' group by
#            default. Do not sets it as empty or it will run
#            as wheel.
# sickrage_data_dir:    Directory where sickrage configuration
#            data is stored.
#            Default: /var/db/sickrage

. /etc/rc.subr
name="sickrage"
rcvar="${name}_enable"
load_rc_config ${name}

: ${sickrage_enable:="NO"}
: ${sickrage_user:="media"}
: ${sickrage_group:="media"}
: ${sickrage_data_dir:="/var/db/sickrage"}

pidfile="/var/run/sickrage/sickrage.pid"
command="/usr/local/bin/python2.7"
command_args="/usr/local/share/sickrage/SickRage/SickBeard.py --datadir ${sickrage_data_dir} -d --pidfile ${pidfile} -q --nolaunch"

start_precmd="sickrage_prestart"
sickrage_prestart() {
    if [ -f ${pidfile} ]; then
        rm -f ${pidfile}
        echo "Removing stale pidfile."
    elif [ ! -d ${pidfile%/*} ]; then
        install -d -o $sickrage_user -g $sickrage_group ${pidfile%/*}
    fi

    if [ ! -d ${sickrage_data_dir} ]; then
        install -d -o ${sickrage_user} -g ${sickrage_group} ${sickrage_data_dir}
    fi
}

run_rc_command "$1"

chmod 777 /usr/local/etc/rc.d/sickrage
echo 'sickrage_enable="YES"' >> /etc/rc.conf
chown -R media:media /var/run/sickrage
chown -R media:media /var/db/sickrage
chown -R media:media /usr/local/share/sickrage
service sickrage start

Hope this helps
Same works for coachpotato.
 
Last edited:

FlyingPersian

Patron
Joined
Jan 27, 2014
Messages
237
when you type
Code:
service sickrage start

what happens?

sickrage does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d)

@Nucshuco

I'll give it a shot, thanks!

It worked! Thanks!
 
Last edited:
Joined
Jul 29, 2018
Messages
1
This is how I did it
create new jail sickrage
jexec into the jail
pkg upgrade
pkg install sabnzbdplus (not sure exactly what i needed so i installed it)
mkdir /usr/local/share/sickrage
chmod -R 777 /usr/local/share/sickrage
mkdir /var/run/sickrage
chmod -R 777 /var/run/sickrage
mkdir /var/db/sickrage
chmod -R 777 /var/db/sickrage
cd /usr/local/share/sickrage
git clone https://github.com/SickRage/SickRage.git
chown -R media:media SickRage
touch /usr/local/etc/rc.d/sickrage copy startup script and paste into /usr/local/etc/rc.d/sickrage
Code:
#!/bin/sh
#
# PROVIDE: sickrage
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# sickrage_enable (bool):	Set to NO by default.
#			Set it to YES to enable it.
# sickrage_user:	The user account sickrage daemon runs as what
#			you want it to be. It uses 'media' user by
#			default. Do not sets it as empty or it will run
#			as root.
# sickrage_group:	The group account sickrage daemon runs as what
#			you want it to be. It uses 'media' group by
#			default. Do not sets it as empty or it will run
#			as wheel.
# sickrage_data_dir:	Directory where sickrage configuration
#			data is stored.
#			Default: /var/db/sickrage

. /etc/rc.subr
name="sickrage"
rcvar="${name}_enable"
load_rc_config ${name}

: ${sickrage_enable:="NO"}
: ${sickrage_user:="media"}
: ${sickrage_group:="media"}
: ${sickrage_data_dir:="/var/db/sickrage"}

pidfile="/var/run/sickrage/sickrage.pid"
command="/usr/local/bin/python2.7"
command_args="/usr/local/share/sickrage/SickRage/SickBeard.py --datadir ${sickrage_data_dir} -d --pidfile ${pidfile} -q --nolaunch"

start_precmd="sickrage_prestart"
sickrage_prestart() {
	if [ -f ${pidfile} ]; then
		rm -f ${pidfile}
		echo "Removing stale pidfile."
	elif [ ! -d ${pidfile%/*} ]; then
		install -d -o $sickrage_user -g $sickrage_group ${pidfile%/*}
	fi

	if [ ! -d ${sickrage_data_dir} ]; then
		install -d -o ${sickrage_user} -g ${sickrage_group} ${sickrage_data_dir}
	fi
}

run_rc_command "$1"

chmod 777 /usr/local/etc/rc.d/sickrage
echo 'sickrage_enable="YES"' >> /etc/rc.conf
chown -R media:media /var/run/sickrage
chown -R media:media /var/db/sickrage
chown -R media:media /usr/local/share/sickrage
service sickrage start

Hope this helps
Same works for coachpotato.

Hi Nucshuco
I seem to be stuck somewhere in setting this up..
I 'think' I've done everything correctly, however, when attempting to start your script I get the following error;

root@mediamanagement:/usr/local/share/sickrage # service sickrage start
Starting sickrage.
Unmatched ".
Unmatched ".
/usr/local/etc/rc.d/sickrage: WARNING: failed to start sickrage


Any idea where I could be going wrong? The only thing I didn't do was install sabnzbdplus.
 
Status
Not open for further replies.
Top