fixed some typos
changes pkg_add to pkg install
This Howto is intended to show, how to install and Update Sabnzbd inside a Jail.
First of all a big Thx to alexey123 for his Help, and for all other where i borrowed some sentences.
Prerequisites:
You need to have a fully working jail , to do it , please read the excelent Wiki article: "http://wiki.nas4free.org/doku.php?id=do ... owto:jails"
or use fsbruva excelent TheBrig jail manager: viewtopic.php?f=79&t=3894
and create a Jail, i call it Sabnzbd (in this Howto i refer to TheBrig created Jails), and stop it.
Before we are going to our Jail u have to create your download Folders on your storage.
I this example i create a main Folder Download.(my Storage Mount in this example is called Data)
Inside we create 5 Folders.
Backup (optional)
Complete
Conf(i recommend this because so we have our config external and even of N4F new install all is safe)
Incomplete
Scripts(optional)
Code: Select all
mkdir /mnt/Data/Download
mkdir /mnt/Data/Download/Backup
mkdir /mnt/Data/Download/Complete
mkdir /mnt/Data/Download/Conf
mkdir /mnt/Data/Download/Incomplete
mkdir /mnt/Data/Download/Scripts
Code: Select all
mkdir /mnt/"Path to your Sabnzbdjail"/mnt/Download
add
Code: Select all
/mnt/Data/Download /mnt/"Path to your SabnzbdJail/mnt/Download nullfs rw 0 0
Now its time to go to our Jail.
Code: Select all
jexec "Sabnzbd JID" csh
root@Sabnzbd:/ #
Code: Select all
pkg install python27 py27-sqlite3 unzip py27-yenc py27-cheetah py27-openssl py27-feedparser py27-utils unrar par2cmdline
Code: Select all
cd tmp
fetch "http://sourceforge.net/projects/sabnzbdplus/files/sabnzbdplus/0.7.16/SABnzbd-0.7.20-src.tar.gz"
tar -xzf SABnzbd-0.7.20-src.tar.gz
rm SABnzbd-0.7.20-src.tar.gz
mv SABnzbd-0.7.20 Sabnzbd
mv Sabnzbd /usr/local/share/
Code: Select all
ee /usr/local/share/Sabnzbd/SABnzbd.py
Attention, at the moment there is a bug(or feature) with phython 2.79 and untrusted ssl certificates.
add this to SABnzbd.py to sort it out until a better way is found(Sabnzb 8 will have it).
(u can also disbale it globally but this would be an security risk)
Code: Select all
opt_out_of_certificate_verification = True
if opt_out_of_certificate_verification:
try:
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
except:
pass
Now we create Sabnzbd start stop script.
Code: Select all
touch /etc/rc.d/sabnzbd
ee /etc/rc.d/sabnzbd
Code: Select all
#!/bin/sh
#
# PROVIDE: sabnzbd
# REQUIRE: NETWORKING DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
#sabnzbd_enable="YES"
#
# It is recommended not to run SABnzbd as root. Add the following
# lines to /etc/rc.conf.local or /etc/rc.conf to run the daemon
# with the credentials of user 'john'
# user 'john'
sabnzbd_enable=${sabnzbd_enable-"NO"}
sabnzbd_user=root
sabnzbd_PATH="/usr/local/share/Sabnzbd/SABnzbd.py"
sabnzbd_conf="/mnt/Download/Conf/sabnzbd.ini"
sabnzbd_IP=""
sabnzbd_PORT="8085"
#sabnzbd_pass=""
#sabnzbd_APIKEY=""
. /etc/rc.subr
name=sabnzbd
rcvar=`set_rcvar`
start_cmd=sabnzbd_start
stop_cmd=sabnzbd_stop
sabnzbd_start() {
PATH=$PATH:/usr/local/bin:/usr/local/sbin; export PATH
checkyesno sabnzbd_enable && su ${sabnzbd_user} -c "$sabnzbd_PATH --daemon -d -f $sabnzbd_conf" -s $sabnzbd_IP:$sabnzbd_PORT
}
sabnzbd_stop() {
sabnzbd_pid=`ps -U ${sabnzbd_user} | grep "python.*SABnzbd.py.*--daemon" | grep -v 'grep' | awk '{print $1}'`
checkyesno sabnzbd_enable && if [ -n "${sabnzbd_pid}" ]; then kill ${sabnzbd_pid}; fi
}
load_rc_config ${name}
run_rc_command "$1"
sabnzbd_conf="/mnt/Data/Download/Conf/sabnzbd.ini"
sabnzbd_PORT="8085"
to your needs(the Rest of the Parametes is not needed)
save it.
We need to make executable
Code: Select all
chmod 755 /etc/rc.d/sabnzbd
Code: Select all
sabnzbd_enable="YES"
This autostarts Sabnzbd with Jailstart
Now we should be able to start and stop Sabnzbd
Code: Select all
/etc/rc.d/sabnzbd start
Code: Select all
/etc/rc.d/sabnzbd stop
When u start Sabnzbd first time(after Wizard) you need to assign your Folders under Settings Folders
Temp Download Folder incomplete...
Finished Folder Complete...
I hope this will Help some of you to get it running
Updating Sabnzbd is easy, go inside your Jail stop Sabnzbd and just install new version
(since we made our config file external in conf Folder our settings are all preserved)
Code: Select all
/etc/rc.d/sabnzbd stop
cd tmp
rm -rf /usr/local/share/Sabnzbd
fetch "http://sourceforge.net/projects/sabnzbdplus/files/sabnzbdplus/new Version"
tar -xzf new Version.tar.gz
rm new Version.tar.gz
mv new Version Sabnzbd
mv Sabnzbd /usr/local/share/
Code: Select all
ee /usr/local/share/Sabnzbd/SABnzbd.py
Start Sabnzbd
Code: Select all
/etc/rc.d/sabnzbd start





