Install CouchPotatoServer from Source on CentOS 6

Welcome back! This is our final Usenet how-to for installing CouchPotatoServer, which is also very similar to the one covering SickBeard and Headphones, and if you've been following along since the SABnzbd how-to, then we still have no pre-requisites to worry about. To start, let's get our source files:

cd /apps
git clone git://github.com/RuudBurger/CouchPotatoServer.git CouchPotatoServer
mkdir /apps/data/.couchpotatoserver

And...you guessed it, let's create our init script:

vi /etc/init.d/CouchPotatoServer

Here is the init script I use (again, works for me but may not be the best):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          CouchPotatoServer
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts CouchPotatoServer
# Description:       starts CouchPotatoServer
### END INIT INFO

# Source function library.
. /etc/init.d/functions

## Variables
prog=CouchPotatoServer
lockfile=/var/lock/subsys/$prog
homedir=/apps/CouchPotatoServer
datadir=/apps/data/.couchpotatoserver
configfile=/apps/data/.couchpotatoserver/couchpotatoserver.conf
pidfile=/var/run/couchpotatoserver.pid
nice=
##

options=" --daemon --config_file $configfile --pid_file $pidfile --data_dir $datadir --quiet"

start() {
        # Start daemon.
        echo -n $"Starting $prog: "
        daemon --pidfile=$pidfile $nice python $homedir/CouchPotato.py $options
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch $lockfile
        return $RETVAL
}

stop() {
        echo -n $"Shutting down $prog: "
        killproc -p $pidfile python
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f $lockfile
        return $RETVAL
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status $prog
        ;;
  restart|force-reload)
        stop
        start
        ;;
  try-restart|condrestart)
        if status $prog > /dev/null; then
            stop
            start
        fi
        ;;
  reload)
        exit 3
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
        exit 2
esac

Now for our final bit of cleanup:

chmod 755 /etc/init.d/CouchPotatoServer
chkconfig CouchPotatoServer on
/etc/init.d/CouchPotatoServer start

CouchPotatoServer is now running, and is live at http://0.0.0.0:5050 (again, replace 0.0.0.0 with the IP of your CouchPotatoServer server), and configure.

We made it! Hopefully you have everything set up and configure to work the way you like. I may publish some configuration-related posts in the future, so be sure to check back. Let me know what you think about these posts!


Related Posts


Share on: Twitter | Facebook | Google+ | Email


comments powered by Disqus