Need help installing Jackett on FreeNAS in a Jail

Status
Not open for further replies.

Moksh Mridul

Dabbler
Joined
Mar 3, 2014
Messages
17
Hi Guys,

I currently run the latest (as of date) version of FreeNAS with the following jails up and running:

1) Transmission
2) Plex
3) Couchpotato
4) Sonarr

I would really like to install Jackett (Found here: http://jackett.net/ or https://github.com/zone117x/Jackett) on my FreeNAS box so that i can get better trackers.

I am completely lost on how to go about this, or even start after getting s blank jail template up and running.

I would highly appreciate any help in this matter. :)

Thank you in advance.

Regards
Moksh
 

Ixian

Patron
Joined
May 11, 2015
Messages
218
Your forum handle/name is right there on the left, you don't need to sign your posts we know who you are :)

According to the developers of Jackett it will run under Mono...maybe. It may not work at all or may work strangely. Also they've only tried it on Linux distros, though that shouldn't matter.

I haven't tried this, just going by how you install ports normally/deal with other Mono apps. In your new Jail install Mono from the ports repo. There's lots of examples of how to install ports on the forums so I won't go in to detail but the basics are:

pkg update && pkg upgrade -y
pkg install lang/mono

Looks like it also needs Curl so make sure that is installed/up to date

pkg install ftp/curl

Download and extract the latest Jackett Mono release from http://jackett.net/Download in to the directory of your choice.

Now run
mono JackettConsole.exe

You might need to specify the path to mono; the port puts it in /usr/local/bin/mono

If it appears to work, next try browsing to http://<your.jail.ip.address>:9117 and see if you can log in/get it to actually work.

If it actually works, lucky you. Now you just need to make a little startup script so it starts/stops on boot. There are lots of examples here how to do that, check out the one for NZBDrone for example (which also uses Mono):

https://forums.freenas.org/index.php?threads/nzbdrone-and-freebsd-freenas.16459/page-2#post-104834

Again, keep in mind that the Jackett developers don't seem too confident in the Mono version right now as it is, and they have only tried it under Linux based distros. Since we're talking about Mono the latter shouldn't in theory matter but - this may not work even if you do everything right. Good luck!
 

Moksh Mridul

Dabbler
Joined
Mar 3, 2014
Messages
17
Your forum handle/name is right there on the left, you don't need to sign your posts we know who you are :)

According to the developers of Jackett it will run under Mono...maybe. It may not work at all or may work strangely. Also they've only tried it on Linux distros, though that shouldn't matter.

I haven't tried this, just going by how you install ports normally/deal with other Mono apps. In your new Jail install Mono from the ports repo. There's lots of examples of how to install ports on the forums so I won't go in to detail but the basics are:

pkg update && pkg upgrade -y
pkg install lang/mono

Looks like it also needs Curl so make sure that is installed/up to date

pkg install ftp/curl

Download and extract the latest Jackett Mono release from http://jackett.net/Download in to the directory of your choice.

Now run
mono JackettConsole.exe

You might need to specify the path to mono; the port puts it in /usr/local/bin/mono

If it appears to work, next try browsing to http://<your.jail.ip.address>:9117 and see if you can log in/get it to actually work.

If it actually works, lucky you. Now you just need to make a little startup script so it starts/stops on boot. There are lots of examples here how to do that, check out the one for NZBDrone for example (which also uses Mono):

https://forums.freenas.org/index.php?threads/nzbdrone-and-freebsd-freenas.16459/page-2#post-104834

Again, keep in mind that the Jackett developers don't seem too confident in the Mono version right now as it is, and they have only tried it under Linux based distros. Since we're talking about Mono the latter shouldn't in theory matter but - this may not work even if you do everything right. Good luck!


Thank you so much for the help. I got it runing, but im completely lost of how to make the startup script. I went through that thread u linked above, but i cant seem to get it to work. Also googled it, but being a n00b, im totally lost. Any possible way you could help me a little more with getting the startup script up and running

Thanks
PS- Took your advice on not signing the note :)
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Thank you so much for the help. I got it runing, but im completely lost of how to make the startup script. I went through that thread u linked above, but i cant seem to get it to work. Also googled it, but being a n00b, im totally lost. Any possible way you could help me a little more with getting the startup script up and running

Thanks
PS- Took your advice on not signing the note :)
this is how I started
https://www.freebsd.org/doc/en/articles/rc-scripting/

I also recommend checking out /usr/local/etc/rc.d/sonarr in your sonarr jail.
 

Moksh Mridul

Dabbler
Joined
Mar 3, 2014
Messages
17
this is how I started
https://www.freebsd.org/doc/en/articles/rc-scripting/

I also recommend checking out /usr/local/etc/rc.d/sonarr in your sonarr jail.

I went through the first couple of pages of the link and ended up even more confused. I also tried copying the sonarr.sh file and making the changes, however, i keep getting an error
"/usr/local/etc/rc.d/jackett: 39: Syntax error: Unterminated quoted string"

How do i proceed, since google doesnt seem to yield any possible clues
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I went through the first couple of pages of the link and ended up even more confused. I also tried copying the sonarr.sh file and making the changes, however, i keep getting an error
"/usr/local/etc/rc.d/jackett: 39: Syntax error: Unterminated quoted string"

How do i proceed, since google doesnt seem to yield any possible clues
You should post what you have so far so we can help.
 

Moksh Mridul

Dabbler
Joined
Mar 3, 2014
Messages
17
Name of Jail: other
Jackett Installed Directory: /opt/jackett
Jackett file to be run: JackettConsole.exe
jackett.sh file stored at /usr/local/etc/rc.d/jackett

Code:
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: jackett
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# sonarr_enable:	Set to YES to enable sonarr
#			Default: NO
# sonarr_user:	The user account used to run the sonarr daemon.
#			This is optional, however do not specifically set this to an
#			empty string as this will cause the daemon to run as root.
#			Default: media
# sonarr_group:	The group account used to run the sonarr daemon.
#			This is optional, however do not specifically set this to an
#			empty string as this will cause the daemon to run with group wheel.
#			Default: media
# sonarr_data_dir:	Directory where sonarr configuration
#			data is stored.
#			Default: /var/db/sonarr

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

: ${jackett_enable:="NO"}
: ${jackett_user:="media"}
: ${jackett_group:="media"}
: ${jackett_data_dir:=“/opt/jackett“}

pidfile=“${jackett_data_dir}/jackett.pid"
command="/usr/sbin/daemon"
procname="/usr/local/bin/mono"
command_args="-f ${procname} /jackett/JackettConsole.exe --data=${jackett_data_dir} --nobrowser"

start_precmd=jackett_precmd
jackett_precmd() {
	if [ ! -d ${jackett_data_dir} ]; then
		install -d -o ${jackett_user} -g ${jackett_group} ${jackett_data_dir}
	fi

	export XDG_CONFIG_HOME=${jackett_data_dir}
}

run_rc_command "$1"
 

Moksh Mridul

Dabbler
Joined
Mar 3, 2014
Messages
17
Ninja Edit: I installed mono using the method given by Ixian in the post above. I can run jackett by using mono /opt/jackett/JackettConsole.exe
However, the process stops when i close the ssh session
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I don't know anything about Jackett except a quick look at the readme
  • fix those strange quotes on line 35 and 37
  • your line 40 isn't even point to your exe location?
  • run "/opt/jackett/JackettConsole.exe --help" and see what flags are available
  • change line 40 to the actual flags you want to run with. the --data and --nobrowser flags are probably sonarr specific
  • if jackett has some type of daemon flag you may nnot need to use freebsd's daemon. this could simplify your script a bit.
  • line 48 was something I needed to put in for sonarr to work, likely irrelevant to jackett
 

Moksh Mridul

Dabbler
Joined
Mar 3, 2014
Messages
17
Thank you for the help, but ut still wont start the service if i type "service jackett start". My notes are in bold below:

I don't know anything about Jackett except a quick look at the readme
  • fix those strange quotes on line 35 and 37 (what quotes in specific, sorry im very new to CLI)
  • your line 40 isn't even point to your exe location? (changed it to /opt/jackett/JackettConsole.exe)
  • run "/opt/jackett/JackettConsole.exe --help" and see what flags are available (i removed all the flags from the line, it now reads : command_args="-f ${procname} /opt/jackett/JackettConsole.exe")
  • change line 40 to the actual flags you want to run with. the --data and --nobrowser flags are probably sonarr specific (same as above)
  • if jackett has some type of daemon flag you may nnot need to use freebsd's daemon. this could simplify your script a bit. (im not sure of this, hence i wont touch it, unless required, or guided)
  • line 48 was something I needed to put in for sonarr to work, likely irrelevant to jackett (removed the line)


My Revised code is below


Code:
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: jackett
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# sonarr_enable:    Set to YES to enable sonarr
#            Default: NO
# sonarr_user:    The user account used to run the sonarr daemon.
#            This is optional, however do not specifically set this to an
#            empty string as this will cause the daemon to run as root.
#            Default: media
# sonarr_group:    The group account used to run the sonarr daemon.
#            This is optional, however do not specifically set this to an
#            empty string as this will cause the daemon to run with group wheel.
#            Default: media
# sonarr_data_dir:    Directory where sonarr configuration
#            data is stored.
#            Default: /var/db/sonarr

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

: ${jackett_enable:="NO"}
: ${jackett_user:="media"}
: ${jackett_group:="media"}
: ${jackett_data_dir:=“/opt/jackett“}

pidfile=“${jackett_data_dir}/jackett.pid"
command="/usr/sbin/daemon"
procname="/usr/local/bin/mono"
command_args="-f ${procname} /opt/jackett/JackettConsole.exe"

start_precmd=jackett_precmd
jackett_precmd() {
    if [ ! -d ${jackett_data_dir} ]; then
        install -d -o ${jackett_user} -g ${jackett_group} ${jackett_data_dir}
    fi

}

run_rc_command "$1"

 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
please look again at the lines I specified. the quotes are different then all the other lines.

When I said to run jackett with the --help flag, I meant actually do it and read the output. That way you can see what flags it accepts.

Most programs have a data-direcory (what your specifying with "jackett_data_dir") that they store their database/data in, separate from their ap[plication file(s), which in this case is the .exe. Just explaining what that line is for because you seem to just have copied a bunch of data-directory lines over without even using them.
 

Moksh Mridul

Dabbler
Joined
Mar 3, 2014
Messages
17
please look again at the lines I specified. the quotes are different then all the other lines.

When I said to run jackett with the --help flag, I meant actually do it and read the output. That way you can see what flags it accepts.

Most programs have a data-direcory (what your specifying with "jackett_data_dir") that they store their database/data in, separate from their ap[plication file(s), which in this case is the .exe. Just explaining what that line is for because you seem to just have copied a bunch of data-directory lines over without even using them.


Thank you so much for the help.I managed to fix it, though im not quite sure what from the below list fixed it, however here are things i did after your post:

1) Edited the code (final can be found below)
2) Copied the jackett.sh file to all etc/rc.d folders
3) ran "echo 'jackett_enable="YES"' >> /etc/rc.conf"

Code:
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: jackett
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# sonarr_enable:    Set to YES to enable sonarr
#            Default: NO
# sonarr_user:    The user account used to run the sonarr daemon.
#            This is optional, however do not specifically set this to an
#            empty string as this will cause the daemon to run as root.
#            Default: media
# sonarr_group:    The group account used to run the sonarr daemon.
#            This is optional, however do not specifically set this to an
#            empty string as this will cause the daemon to run with group wheel.
#            Default: media
# sonarr_data_dir:    Directory where sonarr configuration
#            data is stored.
#            Default: /var/db/sonarr

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

: ${jackett_enable:=“YES”}
#: ${jackett_user:=“daemon”}
#: ${jackett_group:=“wheel”}
#: ${jackett_data_dir:=“/opt/jackett“}

#pidfile=“${jackett_data_dir}/jackett.pid"
command="/usr/sbin/daemon"
procname="/usr/local/bin/mono"
command_args="${procname} /opt/jackett/JackettConsole.exe"

start_precmd=jackett_precmd
jackett_precmd() {
    if [ ! -d ${jackett_data_dir} ]; then
        install -d -o ${jackett_user} -g ${jackett_group} ${jackett_data_dir}
    fi

}

run_rc_command "$1"


Now the plugin starts on jail bootup :)

Thanks a lot for the help guys. Highly appreciated.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
glad it worked. Not sure why you copied it everywhere, it only should be in /usr/local/etc/rc.d as the other places are for OS init scripts.
 

noobi3

Dabbler
Joined
May 2, 2014
Messages
24
I reached to the point where you run Jackett and it runs while the shell is open only

i cannot figure out how to get it to start on your script

I am a noob on a matter of scripts

would you be kind enough if you could just write out a simple guide with each command to getting the startup script working

I would greatly appreciate it

Thanks
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
there's a script two posts above, did you try using that?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
i dont know how to use that
i am a complete noob
use an editor (i suggest ee) to create the script in the jail. make it executable. and enable the service, then start it.

ee /usr/local/etc/rc.d/jackett
chmod +x /usr/local/etc/rc.d/jackett
sysrc jackett_enable=YES
service jackett start
 

noobi3

Dabbler
Joined
May 2, 2014
Messages
24
Wow that did it thanks man;)
btw great guides about sickrage sab and cp

greatly appreciate it
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Wow that did it thanks man;)
btw great guides about sickrage sab and cp

greatly appreciate it
awesome, glad it worked
 
Status
Not open for further replies.
Top