Sick Beard: Difference between revisions
From Leo's Notes
This page was last edited on 18 June 2013, at 06:28.
No edit summary |
No edit summary |
||
| Line 9: | Line 9: | ||
yum -y update | yum -y update | ||
yum -y install wget git unzip par2cmdline | yum -y install wget git unzip par2cmdline pyOpenSSL openssl | ||
# | |||
# Instal unrar | |||
# | |||
cd ~ | cd ~ | ||
wget http://www.rarlab.com/rar/unrar-linux-x64.gz | wget http://www.rarlab.com/rar/unrar-linux-x64.gz | ||
| Line 16: | Line 19: | ||
chmod 755 unrar-linux-x64 | chmod 755 unrar-linux-x64 | ||
mv unrar-linux-x64 /usr/bin/unrar | mv unrar-linux-x64 /usr/bin/unrar | ||
cd ~ | cd ~ | ||
| Line 31: | Line 30: | ||
cd Cheetah-2.4.4 | cd Cheetah-2.4.4 | ||
sudo python setup.py install | sudo python setup.py install | ||
# | |||
# Install SABnzbd | |||
# | |||
cd ~ | |||
wget http://downloads.sourceforge.net/project/sabnzbdplus/sabnzbdplus/0.7.13/SABnzbd-0.7.13-src.tar.gz | |||
tar -xzf SABnzbd-0.7.13-src.tar.gz | |||
mv SABnzbd-0.7.13 /usr/share/SABnzbd | |||
useradd -r -M sabnzbd | |||
# Create /etc/init.d/SABnzbd with the contents defined below. | |||
# Create /etc/sysconfig/SABnzbd with the contents below. | |||
cd /usr/share/SABnzbd | |||
sudo -u sabnzbd python SABnzbd.py | |||
cd ~ | cd ~ | ||
| Line 40: | Line 58: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<syntaxhighlight lang="text" line start="1" enclose="div"> | |||
#!/bin/sh | |||
# chkconfig: - 20 80 | |||
# description: SABnzbd | |||
exec="/usr/share/SABnzbd/SABnzbd.py" | |||
prog="SABnzbd" | |||
if [ -f /etc/sysconfig/$prog ]; then | |||
. /etc/sysconfig/$prog | |||
fi | |||
if [ ! -n "$sabuser" -o ! -n "$apikey" -o ! -n "$protocol" -o ! -n "$host" -o ! -n "$port" ]; then | |||
echo "Please configure /etc/sysconfig/$prog first." | |||
[ ! -n "$sabuser" ] && echo -n " sabuser" | |||
[ ! -n "$apikey" ] && echo -n " apikey" | |||
[ ! -n "$protocol" ] && echo -n " protocol" | |||
[ ! -n "$host" ] && echo -n " host" | |||
[ ! -n "$port" ] && echo -n " port" | |||
echo " variable(s) undefined" | |||
exit 1 | |||
fi | |||
if [ ! -f "$config" ]; then | |||
echo "Can't find $config." | |||
echo "Please run SABnzbd as $sabuser manually to configure it first." | |||
exit 1 | |||
fi | |||
# Source function library. | |||
. /etc/rc.d/init.d/functions | |||
start() { | |||
[ -x $exec ] || exit 5 | |||
[ -f $config ] || exit 6 | |||
echo -n $"Starting $prog: " | |||
# if not running, start it up here, usually something like "daemon $exec" | |||
daemon --user=$sabuser $nicecmd $exec -d -f $config | |||
retval=$? | |||
echo | |||
return $retval | |||
} | |||
stop() { | |||
echo -n $"Stopping $prog: " | |||
if [ -n "$username" ]; then | |||
/usr/bin/wget -q --delete-after --no-check-certificate "${protocol}://${host}:${port}/sabnzbd/api?mode=shutdown&ma_username=${username}&ma_password=${password}&apikey=${apikey}" | |||
else | |||
/usr/bin/wget -q --delete-after --no-check-certificate "${protocol}://${host}:${port}/sabnzbd/api?mode=shutdown&apikey=${apikey}" | |||
fi | |||
for sleepval in 1s 5s 10s 20s;do | |||
sleep $sleepval | |||
if [ ! `rh_status_q` ];then | |||
echo_success | |||
echo | |||
return 0 | |||
fi | |||
done | |||
echo_failure | |||
return 1 | |||
} | |||
restart() { | |||
stop | |||
start | |||
} | |||
reload() { | |||
restart | |||
} | |||
force_reload() { | |||
restart | |||
} | |||
rh_status() { | |||
# run checks to determine if the service is running or use generic status | |||
/usr/bin/nc -z $host $port &> /dev/null | |||
retval=$? | |||
if [ $retval -eq 0 ];then | |||
pid=`ps -fu $sabuser | grep -v grep | grep SABnzbd.py | awk '{print $2}'` | |||
echo "$prog (pid $pid) is running..." | |||
return $retval | |||
else | |||
echo "$prog is stopped" | |||
return $retval | |||
fi | |||
} | |||
rh_status_q() { | |||
rh_status >/dev/null 2>&1 | |||
} | |||
case "$1" in | |||
start) | |||
rh_status_q && exit 0 | |||
$1 | |||
;; | |||
stop) | |||
rh_status_q || exit 0 | |||
$1 | |||
;; | |||
restart) | |||
$1 | |||
;; | |||
reload) | |||
rh_status_q || exit 7 | |||
$1 | |||
;; | |||
force-reload) | |||
force_reload | |||
;; | |||
status) | |||
rh_status | |||
;; | |||
condrestart|try-restart) | |||
rh_status_q || exit 0 | |||
restart | |||
;; | |||
*) | |||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" | |||
exit 2 | |||
esac | |||
exit $? | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="text" line start="1" enclose="div"> | |||
# SABnzbd service configuration | |||
#run SABnzbd as | |||
sabuser=sabnzbd | |||
#modify if SABnzbd config file is somewhere else for some reason | |||
config="/usr/share/SABnzbd/sabnzbd.ini" | |||
#API key (can be found in the above config file) | |||
apikey=asdfkljsadfkj | |||
#gui address, eg: ${protocol}://${host}:${port}/sabznbd/ | |||
protocol=http | |||
host=localhost | |||
port=8080 | |||
#leave blank if no username/password is required to access the gui | |||
username= | |||
password= | |||
#use nice, ionice, taskset to start SABnzbd | |||
nicecmd= | |||
# example: nicecmd="nice -n 19 ionice -c3" | |||
</syntaxhighlight> | |||
[[Category:Todo]] | [[Category:Todo]] | ||
Revision as of 06:28, 18 June 2013
http://sickbeard.com/install.html#Source
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum -y update
yum -y install wget git unzip par2cmdline pyOpenSSL openssl
#
# Instal unrar
#
cd ~
wget http://www.rarlab.com/rar/unrar-linux-x64.gz
gunzip unrar-linux-x64.gz
chmod 755 unrar-linux-x64
mv unrar-linux-x64 /usr/bin/unrar
cd ~
wget http://sabnzbd.sourceforge.net/yenc-0.3.tar.gz
cd ~
wget http://pypi.python.org/packages/source/C/Cheetah/Cheetah-2.4.4.tar.gz
tar -zxvf Cheetah-2.4.4.tar.gz
cd Cheetah-2.4.4
sudo python setup.py install
#
# Install SABnzbd
#
cd ~
wget http://downloads.sourceforge.net/project/sabnzbdplus/sabnzbdplus/0.7.13/SABnzbd-0.7.13-src.tar.gz
tar -xzf SABnzbd-0.7.13-src.tar.gz
mv SABnzbd-0.7.13 /usr/share/SABnzbd
useradd -r -M sabnzbd
# Create /etc/init.d/SABnzbd with the contents defined below.
# Create /etc/sysconfig/SABnzbd with the contents below.
cd /usr/share/SABnzbd
sudo -u sabnzbd python SABnzbd.py
cd ~
git clone git://github.com/midgetspy/Sick-Beard.git my-sickbeard-install
cd my-sickbeard-install
python SickBeard.py
#!/bin/sh
# chkconfig: - 20 80
# description: SABnzbd
exec="/usr/share/SABnzbd/SABnzbd.py"
prog="SABnzbd"
if [ -f /etc/sysconfig/$prog ]; then
. /etc/sysconfig/$prog
fi
if [ ! -n "$sabuser" -o ! -n "$apikey" -o ! -n "$protocol" -o ! -n "$host" -o ! -n "$port" ]; then
echo "Please configure /etc/sysconfig/$prog first."
[ ! -n "$sabuser" ] && echo -n " sabuser"
[ ! -n "$apikey" ] && echo -n " apikey"
[ ! -n "$protocol" ] && echo -n " protocol"
[ ! -n "$host" ] && echo -n " host"
[ ! -n "$port" ] && echo -n " port"
echo " variable(s) undefined"
exit 1
fi
if [ ! -f "$config" ]; then
echo "Can't find $config."
echo "Please run SABnzbd as $sabuser manually to configure it first."
exit 1
fi
# Source function library.
. /etc/rc.d/init.d/functions
start() {
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
echo -n $"Starting $prog: "
# if not running, start it up here, usually something like "daemon $exec"
daemon --user=$sabuser $nicecmd $exec -d -f $config
retval=$?
echo
return $retval
}
stop() {
echo -n $"Stopping $prog: "
if [ -n "$username" ]; then
/usr/bin/wget -q --delete-after --no-check-certificate "${protocol}://${host}:${port}/sabnzbd/api?mode=shutdown&ma_username=${username}&ma_password=${password}&apikey=${apikey}"
else
/usr/bin/wget -q --delete-after --no-check-certificate "${protocol}://${host}:${port}/sabnzbd/api?mode=shutdown&apikey=${apikey}"
fi
for sleepval in 1s 5s 10s 20s;do
sleep $sleepval
if [ ! `rh_status_q` ];then
echo_success
echo
return 0
fi
done
echo_failure
return 1
}
restart() {
stop
start
}
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
# run checks to determine if the service is running or use generic status
/usr/bin/nc -z $host $port &> /dev/null
retval=$?
if [ $retval -eq 0 ];then
pid=`ps -fu $sabuser | grep -v grep | grep SABnzbd.py | awk '{print $2}'`
echo "$prog (pid $pid) is running..."
return $retval
else
echo "$prog is stopped"
return $retval
fi
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?
# SABnzbd service configuration
#run SABnzbd as
sabuser=sabnzbd
#modify if SABnzbd config file is somewhere else for some reason
config="/usr/share/SABnzbd/sabnzbd.ini"
#API key (can be found in the above config file)
apikey=asdfkljsadfkj
#gui address, eg: ${protocol}://${host}:${port}/sabznbd/
protocol=http
host=localhost
port=8080
#leave blank if no username/password is required to access the gui
username=
password=
#use nice, ionice, taskset to start SABnzbd
nicecmd=
# example: nicecmd="nice -n 19 ionice -c3"