Sickbeard/Couchpotato Server


There are some pre-requisites we need first:

sudo apt-get -y install python2.6 python-cheetah python-openssl par2
Some of the apps we’ll be using, especially SABnzbd, are particular about the version of unrar they use, so we should install the non-free ‘official’ version. We need to build that from source (thanks to Anonymous for the steps):
sudo sh -c "echo \"deb-src http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi\" >> /etc/apt/sources.list"
sudo apt-get update
sudo apt-get -y build-dep unrar-nonfree
sudo apt-get source -b unrar-nonfree
sudo dpkg -i unrar*.deb

You’re going to need to know your IP address, and wherever you see the address “172.29.14.110”, replace that with your IP address.

We’re going to use a usergroup for each of the service users, so set that up first:

sudo addgroup nzb
SABnzbd

Now we are ready to grab SABnzbd. Rather than use the full wget URL I’ve used here, go to the SABnzbd SourceForge site and copy the “download now” link from there, to make sure you get the latest “source” version.

Create the user for SABnzbd:

sudo useradd --system --user-group --no-create-home --groups nzb sabnzbd
Download SABnzbd, extract it and move it to the correct location, and set the permissions required:
wget http://downloads.sourceforge.net/project/sabnzbdplus/sabnzbdplus/0.7.3/SABnzbd-0.7.3-src.tar.gz
tar xzf SABnzbd-0.7.3-src.tar.gz
sudo mv SABnzbd-0.7.3 /usr/local/sabnzbd
sudo chown -R sabnzbd:nzb /usr/local/sabnzbd

Create a directory to hold the data:

sudo mkdir /var/sabnzbd
sudo chown sabnzbd:nzb /var/sabnzbd

Try it out (replace the ip address with yours!), this will also create the necessary config files:

sudo su sabnzbd -c "/usr/local/sabnzbd/SABnzbd.py -f /var/sabnzbd -s 172.29.14.110:8080"
You should now be able to point your browser to the SABnzbd address, and complete the wizard. I would strongly recomment You must set a username and password on Step Two, to restrict access. Bear in mind that the rPi has limited resources, so don’t max out the NNTP server connections. For example, my provider allows 50 connections, but just put 5 for the rPi.

Now that all works, press [Ctrl]+[C] to kill the server for now.

Sick Beard

sudo useradd --system --user-group --no-create-home sickbeard
git clone git://github.com/midgetspy/Sick-Beard.git
sudo mv Sick-Beard /usr/local/sickbeard
sudo chown -R sickbeard:nzb /usr/local/sickbeard
sudo chmod ug+rw /usr/local/sickbeard/autoProcessTV/
sudo mkdir /var/sickbeard
sudo chown sickbeard:nzb /var/sickbeard

Fire it up to create the config files and try it:

sudo su sickbeard -c "/usr/local/sickbeard/SickBeard.py --datadir /var/sickbeard --config /var/sickbeard/sickbeard.ini"
Test it! http://172.29.14.110:8081

CouchPotato

sudo useradd --system --user-group --no-create-home couchpotato 
git clone git://github.com/RuudBurger/CouchPotatoServer.git 
sudo mv CouchPotatoServer /usr/local/couchpotato 
sudo chown -R couchpotato:couchpotato /usr/local/couchpotato 
sudo mkdir /var/couchpotato 
sudo chown -R couchpotato:couchpotato /var/couchpotato
sudo su couchpotato -c "/usr/local/couchpotato/CouchPotato.py --data_dir=/var/couchpotato --config_file=/var/couchpotato/couchpotato.ini"

Test at http://172.29.14.110:5050. Again, [Ctrl]+[C] will terminate it.

Auto-Start

To enable all three services to run automatically at startup, we need to create three init scripts and register them.

SABnzbd

Create an init file by typing the next command, and then copying the following text:

sudo nano /etc/init.d/sabnzbd
#!/bin/sh
### BEGIN INIT INFO
# Provides:          SABnzbd
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start SABnzd at boot time
# Description:       Start SABnzbd.
### END INIT INFO

case "$1" in
start)
  echo "Starting SABnzbd."
  /usr/bin/sudo -u sabnzbd -H /usr/local/sabnzbd/SABnzbd.py -d -f /var/sabnzbd/sabnzbd.ini
;;
stop)
  echo "Shutting down SABnzbd."
  p=´ps aux | grep -v grep | grep SABnzbd.py | tr -s \ | cut -d ' ' -f 2´
  if [ -n "$p" ]; then
    kill -2 $p > /dev/null
    while ps -p $p > /dev/null; do sleep 1; done
  fi
;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
esac
exit 0
sudo chmod 755 /etc/init.d/sabnzbd
sudo update-rc.d sabnzbd defaults
sudo /etc/init.d/sabnzbd start

Sick Beard

sudo nano /etc/init.d/sickbeard
#!/bin/sh
### BEGIN INIT INFO
# Provides:          SickBeard
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start SickBeard at boot time
# Description:       Start SickBeard.
### END INIT INFO

case "$1" in
start)
  echo "Starting SickBeard."
  /usr/bin/sudo -u sickbeard -H /usr/local/sickbeard/SickBeard.py -d --datadir /var/sickbeard --config /var/sickbeard/sickbeard.ini
;;
stop)
  echo "Shutting down SickBeard."
  p=´ps aux | grep -v grep | grep SickBeard.py | tr -s \ | cut -d ' ' -f 2´
  if [ -n "$p" ]; then
    sb_api_key=´grep -m 1 api_key ${sb_config} | cut -d ' ' -f 3´;
    sb_port=´grep -m 1 web_port ${sb_config} | cut -d ' ' -f 3´;
    wget -q --delete-after http://localhost:${sb_port}/api/${sb_api_key}/\?cmd=sb.shutdown
    while ps -p $p > /dev/null; do sleep 1; done
  fi
;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
esac

exit 0
sudo chmod 755 /etc/init.d/sickbeard
sudo update-rc.d sickbeard defaults
sudo /etc/init.d/sickbeard start

Couch Potato

sudo nano /etc/init.d/couchpotato
#!/bin/sh
### BEGIN INIT INFO
# Provides: CouchPotato
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start CouchPotato at boot time
# Description: Start CouchPotato.
### END INIT INFO
case "$1" in
start)
 echo "Starting CouchPotato."
 /usr/bin/sudo -u couchpotato -H /usr/local/couchpotato/CouchPotato.py --daemon --data_dirdir=/var/couchpotato --config_file=/var/couchpotato/couchpotato.ini
;;
stop)
 echo "Shutting down CouchPotato."
  p=´ps aux | grep -v grep | grep CouchPotato.py | tr -s \ | cut -d ' ' -f 2´
  couch_api_key=´grep -m 1 api_key /var/couchpotato/couchpotato.ini | cut -d ' ' -f 3´;
  couch_port=´grep -m 1 port /var/couchpotato/couchpotato.ini | cut -d ' ' -f 3´;
 wget -q --delete-after http://localhost:${couch_port}/api/${couch_api_key}/app.shutdown
 while ps -p $p > /dev/null; do sleep 1; done
;;
*)
 echo "Usage: $0 {start|stop}"
 exit 1
esac
exit 0
sudo chmod 755 /etc/init.d/couchpotato
sudo update-rc.d couchpotato defaults
sudo /etc/init.d/couchpotato start

That’s it. That’s the basics sorted. Everything should now be running and working, but nothing is configured specifically for being integrated, or for saving the files to the network. That’s next…

Special thanks to NASDestruction for getting me going, and comments below correcting my mistakes 

Last update:
20-01-2016 16:24
Author:
Karl Hudgell
Revision:
1.0
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Latest FAQs RSS

  1. Custom Button Card (23-11-2020 10:02)
  2. NodeJS on Raspberry Pi Zero (12-10-2020 12:47)
  3. Useful Notes (13-11-2019 12:51)
  4. Dockerized Download VM (30-01-2019 20:26)
  5. Jmeter + Performance Plugin + Jenkins Pipeline (16-02-2018 12:49)