Creating rc script for Jackett

Status
Not open for further replies.

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
you added a new line in the command_args
 

TheDrifter363

Dabbler
Joined
Apr 17, 2017
Messages
10
Omg! Thanks so much Josh! Lol. I was using putty to ssh into my server, so I think it was automatically inserting a new line as I typed past the border. I just had to expand putty's window and it fixed the issue. Ugh, something so simple. I can't believe I didn't see it! Thanks again Josh. I really appreciate it. It's running great now.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
sweet, yeah I always gotta double check those long lines stay how I want them
 

MrUnknownEMC

Explorer
Joined
Feb 20, 2016
Messages
55
@Musabi It looks like you got pretty close to getting it working!

Here's a few issues I see, and also some minor suggestions
* you install 'wget', this really isn't needed, just use 'fetch' to download the binary
* you put the jackett files in /usr/local/bin while the rc.d script you use expects the Jackett files to be in /opt. personally, I think these should be somewhere like /usr/local/share/Jackett
* you could just run 'sysrc jackett_enable=YES' to avoid manually editting /etc/rc.conf
* you should not put user created rc.d scripts in /etc/rc.d, these should be in /usr/local/etc/rc.d
* running as media user could not be working because of permissions (the user running should own /var/db/jackett). But I assume in your case, you never created the media user in your jail
* a jail on FreeNAS is not "linux based" and uses linux in no way =P

Here's what I just tried and it worked as expected
Code:
pkg install mono curl
fetch https://github.com/Jackett/Jackett/releases/download/v0.7.363/Jackett.Binaries.Mono.tar.gz
tar xzf Jackett.Binaries.Mono.tar.gz
mv Jackett /usr/local/share
rm Jackett.Binaries.Mono.tar.gz
sysrc jackett_enable=YES


Create /usr/local/etc/rc.d/jackett
Code:
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: jackett
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable jackett:
# jackett_enable="YES"

. /etc/rc.subr

name="jackett"
rcvar=jackett_enable

load_rc_config $name

: ${jackett_enable="NO"}
: ${jackett_user:="root"}
: ${jackett_data_dir:="/var/db/jackett"}

procname="/usr/local/bin/mono"
command="/usr/sbin/daemon"
command_args="-f ${procname} /usr/local/share/Jackett/JackettConsole.exe -d ${jackett_data_dir}"

start_precmd="export XDG_CONFIG_HOME=${jackett_data_dir}"

run_rc_command "$1"


Code:
chmod +x /usr/local/etc/rc.d/jackett
service jackett strart


I have tired to replicate the OP setup with Jackett within sonnarr and i have bump into some issues:

I have follow the OP setup a bit (The location of the Jackett Mono v0.7.1272 Install but I have used a different version and copy it manually over FTP) and was able to start without any issues not sure if the Jackett Version problem but I can't seem to add my trackers to jackett without giving me errors. I have also follow this guide by creating [This Thread] on separated jail which worked for a few days but after i restart my freenas machine it seem to give me error when i search stuff from that tracker and was not able to re add tracker or any other ones but public trackers seem to work fine. The error i get from this install is different .... way longer errors.

I have no problem setting up Jackett on my main machine PC and I never encounter this type of error. I have upgrade my freenas recently to new process and ram and i just want to move all services to my server instead of running on my PC as i don't really want it to run 24/7.

When I try a different version jackett start up but won't allow me to click on add indextor.

I haven't tried the beta train for 9.10 so I can't really test out the VMs, I don't really want to just run one VM for jackett as i don't really need a window VM at the moment.

Error From Jackett
Code:
04-20 10:57:13 Error Exception in Configure System.Exception: Found no results w																																							 hile trying to browse this tracker
  at Jackett.Services.IndexerManagerService+<TestIndexer>c__async0.MoveNext () [																																							 0x000fa] in <14a3554ace014df2b21ece1781b08657>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] i																																							 n <8f2c484307284b51944a1a13a14c0266>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Thre																																							 ading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNoti																																							 fication (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a																																							 13a14c0266>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.T																																							 asks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <8f2c																																							 484307284b51944a1a13a14c0266>:0
  at Jackett.Controllers.AdminController+<Configure>c__async4.MoveNext () [0x001																																							 e4] in <14a3554ace014df2b21ece1781b08657>:0



This is something to do with permissions?

I will do full uninstall of jackett tonight and retry it, but yesterday i have tried to remake my old jackett setup but same problem, not able to add indextor.
 
Last edited:
Joined
May 10, 2017
Messages
4
@Musabi It looks like you got pretty close to getting it working!

Here's a few issues I see, and also some minor suggestions
* you install 'wget', this really isn't needed, just use 'fetch' to download the binary
* you put the jackett files in /usr/local/bin while the rc.d script you use expects the Jackett files to be in /opt. personally, I think these should be somewhere like /usr/local/share/Jackett
* you could just run 'sysrc jackett_enable=YES' to avoid manually editting /etc/rc.conf
* you should not put user created rc.d scripts in /etc/rc.d, these should be in /usr/local/etc/rc.d
* running as media user could not be working because of permissions (the user running should own /var/db/jackett). But I assume in your case, you never created the media user in your jail
* a jail on FreeNAS is not "linux based" and uses linux in no way =P

Here's what I just tried and it worked as expected
Code:
pkg install mono curl
fetch https://github.com/Jackett/Jackett/releases/download/v0.7.363/Jackett.Binaries.Mono.tar.gz
tar xzf Jackett.Binaries.Mono.tar.gz
mv Jackett /usr/local/share
rm Jackett.Binaries.Mono.tar.gz
sysrc jackett_enable=YES


Create /usr/local/etc/rc.d/jackett
Code:
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: jackett
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable jackett:
# jackett_enable="YES"

. /etc/rc.subr

name="jackett"
rcvar=jackett_enable

load_rc_config $name

: ${jackett_enable="NO"}
: ${jackett_user:="root"}
: ${jackett_data_dir:="/var/db/jackett"}

procname="/usr/local/bin/mono"
command="/usr/sbin/daemon"
command_args="-f ${procname} /usr/local/share/Jackett/JackettConsole.exe -d ${jackett_data_dir}"

start_precmd="export XDG_CONFIG_HOME=${jackett_data_dir}"

run_rc_command "$1"


Code:
chmod +x /usr/local/etc/rc.d/jackett
service jackett strart


Hey Guys,

ive only been running Freenas for 2 months and have set up a nice little media center for my family... for the most part its flawless.
i have created jails for: Sonarr, Plex, couchPotato, Transmission, nginx etc.

Creating a jail to run Jackett from has been quite difficult.
i have followed the posts above and have endlessly searched google to find an simple install procedure without luck.

i have followed the above (as best as i can make out) but i get permission denied when trying to run the service.

Here is the procedure i follow:
Code:
pkg install mono curl

fetch https://github.com/Jackett/Jackett/releases/download/v0.7.1377/Jackett.Binaries.Mono.tar.gz

tar xzf Jackett.Binaries.Mono.tar.gz

mv Jackett /usr/local/share

rm Jackett.Binaries.Mono.tar.gz

sysrc jackett_enable=YES


Code:
mkdir /usr/local/etc/rc.d/jackett


Code:
ee /usr/local/etc/rc.d/jackett.sh


Then i enter the config:

Code:
#!/bin/sh

#

# $FreeBSD$

#


# PROVIDE: jackett

# REQUIRE: LOGIN

# KEYWORD: shutdown


# Add the following lines to /etc/rc.conf to enable jackett:

# jackett_enable="YES"


. /etc/rc.subr


name="jackett"

rcvar=jackett_enable


load_rc_config $name


: ${jackett_enable="NO"}

: ${jackett_user:="root"}

: ${jackett_data_dir:="/var/db/jackett"}


procname="/usr/local/bin/mono"

command="/usr/sbin/daemon"

command_args="-f ${procname} /usr/local/share/Jackett/JackettConsole.exe -d ${jackett_data_dir}"


start_precmd="export XDG_CONFIG_HOME=${jackett_data_dir}"


run_rc_command "$1"


Then

Code:
chmod +x /usr/local/etc/rc.d/jackett

service jackett strart


from this i get an error:

PERMISSION DENIED

Could someone please look over my process and tell me what i could possibly be doing wrong?

Please be gentle ... im new to this :s
 

colmconn

Contributor
Joined
Jul 28, 2015
Messages
174
The
Code:
 mkdir /usr/local/etc/rc.d/jackett
command is unnecessary. You should only have your rc file(s) in /usr/local/etc/rc.d not a directories. Your rc file should be named /usr/local/etc/rc.d/jackett note the absence of .sh from the end of the filename.
 
Joined
May 10, 2017
Messages
4
The
Code:
 mkdir /usr/local/etc/rc.d/jackett
command is unnecessary. You should only have your rc file(s) in /usr/local/etc/rc.d not a directories. Your rc file should be named /usr/local/etc/rc.d/jackett note the absence of .sh from the end of the filename.

Cheers Colmconn,

OMG!
Lesson learned!
Thanks mate!!!!! She all works! :)
 

colmconn

Contributor
Joined
Jul 28, 2015
Messages
174
Glad it worked out. You might want to check out radarr as a replacement for couchpotato. Also, Organizr makes a great unified frontend for all of the individual websites of plex, sonarr, etc.
 

Joshua Walker

Dabbler
Joined
May 8, 2017
Messages
23
im also having a issue trying to make this work

when i start the service, i get:

Code:
su: pam_start: system error
/usr/local/etc/rc.d/jackett: WARNING: failed to start jackett


My script is :
Code:
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: jackett
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable jackett:
# jackett_enable="YES"

. /etc/rc.subr

name="jackett"
rcvar=jackett_enable

load_rc_config $name

: ${jackett_enable="NO"}
: ${jackett_user:="media"}
: ${jackett_data_dir:="/var/db/jackett"}

procname="/usr/local/bin/mono"
command="/usr/sbin/daemon"
command_args="-f ${procname} /opt/Jackett/JackettConsole.exe -d ${jackett_data_dir}"

start_precmd=jackett_precmd

jackett_precmd()
{
		export XDG_CONFIG_HOME=${jackett_data_dir}

		if [ ! -d ${jackett_data_dir} ]; then
				install -d -o ${jackett_user} ${jackett_data_dir}
		fi
}

run_rc_command "$1"


permissions:

Code:
ls -l /var/db/jackett/
total 182
drwxr-xr-x  2 media  media	  17 May  4 16:46 Indexers
-rwxr-xr-x  1 media  media	 439 Jan 10 21:54 ServerConfig.json
-rwxr-xr-x  1 media  media  289020 May 10 23:22 log.txt
-rwxr-xr-x  1 media  media  422077 Apr 24 15:36 updater.txt

ls -l /opt/jackett/
total 4924
-rwxr-xr-x  1 media  media  1223680 Apr 24 15:36 AngleSharp.dll
-rwxr-xr-x  1 media  media   273408 Apr 24 15:36 AutoMapper.dll
-rwxr-xr-x  1 media  media	16896 Apr 24 15:36 Autofac.Integration.Owin.dll
-rwxr-xr-x  1 media  media	 7680 Apr 24 15:36 Autofac.Integration.WebApi.Owin.dll
-rwxr-xr-x  1 media  media	45568 Apr 24 15:36 Autofac.Integration.WebApi.dll
-rwxr-xr-x  1 media  media   212480 Apr 24 15:36 Autofac.dll
-rwxr-xr-x  1 media  media	19968 Apr 24 15:36 CloudFlareUtilities.dll
-rwxr-xr-x  1 media  media	58368 Apr 24 15:36 CommandLine.dll
drwxr-xr-x  7 media  media	   20 Mar  8 12:49 Content
-rwxr-xr-x  1 media  media   815104 Apr 24 15:36 CsQuery.dll
-rwxr-xr-x  1 media  media	53248 Apr 24 15:36 CurlSharp.dll
-rwxr-xr-x  1 media  media	  338 Apr 24 15:36 CurlSharp.dll.config
-rwxr-xr-x  1 media  media	19634 Apr 24 15:36 CurlSharp.dll.mdb
-rwxr-xr-x  1 media  media	12288 Apr 24 15:36 DateTimeRoutines.dll
drwxr-xr-x  2 media  media	  121 Apr 12 16:51 Definitions
-rwxr-xr-x  1 media  media   200704 Apr 24 15:36 ICSharpCode.SharpZipLib.dll
-rwxr-xr-x  1 media  media  1099264 Apr 24 15:36 Jackett.dll
-rwxr-xr-x  1 media  media   204197 Apr 24 15:36 Jackett.dll.mdb
-rwxr-xr-x  1 media  media	13824 Apr 24 15:36 JackettConsole.exe
-rwxr-xr-x  1 media  media	 2456 Apr 24 15:36 JackettConsole.exe.config
-rwxr-xr-x  1 media  media	 2453 Apr 24 15:36 JackettConsole.exe.mdb
-rwxr-xr-x  1 media  media	 4608 Apr 24 15:36 JackettService.exe
-rwxr-xr-x  1 media  media	 2222 Apr 24 15:36 JackettService.exe.config
-rwxr-xr-x  1 media  media	  941 Apr 24 15:36 JackettService.exe.mdb
-rwxr-xr-x  1 media  media   753152 Apr 24 15:36 JackettTray.exe
-rwxr-xr-x  1 media  media	 2456 Apr 24 15:36 JackettTray.exe.config
-rwxr-xr-x  1 media  media	 2002 Apr 24 15:36 JackettTray.exe.mdb
-rwxr-xr-x  1 media  media	11264 Apr 24 15:36 JackettUpdater.exe
-rwxr-xr-x  1 media  media	 2222 Apr 24 15:36 JackettUpdater.exe.config
-rwxr-xr-x  1 media  media	 2113 Apr 24 15:36 JackettUpdater.exe.mdb
-rwxr-xr-x  1 media  media	18047 Apr 24 15:36 LICENSE
-rwxr-xr-x  1 media  media   171672 Apr 24 15:36 Microsoft.AspNet.Identity.Core.dll
-rwxr-xr-x  1 media  media	18088 Apr 24 15:36 Microsoft.Owin.FileSystems.dll
-rwxr-xr-x  1 media  media	88232 Apr 24 15:36 Microsoft.Owin.Host.HttpListener.dll
-rwxr-xr-x  1 media  media   133288 Apr 24 15:36 Microsoft.Owin.Host.SystemWeb.dll
-rwxr-xr-x  1 media  media	64680 Apr 24 15:36 Microsoft.Owin.Hosting.dll
-rwxr-xr-x  1 media  media	64680 Apr 24 15:36 Microsoft.Owin.StaticFiles.dll
-rwxr-xr-x  1 media  media   101032 Apr 24 15:36 Microsoft.Owin.dll
-rwxr-xr-x  1 media  media   348160 Apr 24 15:36 MonoTorrent.dll
-rwxr-xr-x  1 media  media   488960 Apr 24 15:36 NLog.dll
-rwxr-xr-x  1 media  media   658944 Apr 24 15:36 Newtonsoft.Json.dll
-rwxr-xr-x  1 media  media	 4608 Apr 24 15:36 Owin.dll
-rwxr-xr-x  1 media  media	10205 Apr 24 15:36 README.md
-rwxr-xr-x  1 media  media	22232 Apr 24 15:36 System.Net.Http.Extensions.dll
-rwxr-xr-x  1 media  media   185544 Apr 24 15:36 System.Net.Http.Formatting.dll
-rwxr-xr-x  1 media  media	21720 Apr 24 15:36 System.Net.Http.Primitives.dll
-rwxr-xr-x  1 media  media	62152 Apr 24 15:36 System.Web.Http.Owin.dll
-rwxr-xr-x  1 media  media	29384 Apr 24 15:36 System.Web.Http.Tracing.dll
-rwxr-xr-x  1 media  media   471240 Apr 24 15:36 System.Web.Http.dll
-rwxr-xr-x  1 media  media	  627 Apr 24 15:36 Upstart.config
-rwxr-xr-x  1 media  media   181248 Apr 24 15:36 YamlDotNet.dll
-rwxr-xr-x  1 media  media   499977 Apr 23 15:28 log.20170423.00333.txt
-rwxr-xr-x  1 media  media   499921 Apr 23 15:30 log.20170423.00334.txt
-rwxr-xr-x  1 media  media   499998 Apr 23 15:33 log.20170423.00335.txt
-rwxr-xr-x  1 media  media   495796 Apr 23 18:02 log.20170423.00336.txt
-rwxr-xr-x  1 media  media   499951 Apr 30 05:16 log.20170430.00000.txt


rc.conf

Code:
portmap_enable="NO"
sshd_enable="YES"
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
hostname="jackett"
devfs_enable="YES"
devfs_system_ruleset="devfsrules_common"
inet6_enable="YES"
jackett_enable="YES"
ip6addrctl_enable="YES"
 

Joshua Walker

Dabbler
Joined
May 8, 2017
Messages
23
NVM, it was a permission problem. I made a bobo by modifying the permissions of the entire jail. So i started from scratch and its working great
 
Joined
May 10, 2017
Messages
4
Glad it worked out. You might want to check out radarr as a replacement for couchpotato. Also, Organizr makes a great unified frontend for all of the individual websites of plex, sonarr, etc.

Thanks mate,
Yeah i created a Radarr jail this morning... i love the interface.
ill look into Organizr shortly, thanks for your help :)
 

TheMunk

Cadet
Joined
Jun 10, 2017
Messages
8
Hey guys - another FreeNas noob asking questions.

I got Jackett running two times now by following your guides, but whenever I stop the jail, I can't restart the service.
Code:
root@Jackett:/ # service jackett start									   
Starting jackett.															 
login class 'daemon' non-existent, using default							 
root@Jackett:/ # service jackett status									   
jackett is not running.													   
root@Jackett:/ #


However, deleting and reinstalling the whole jail i can get it to work again - just not a valid process for when restarting a jail ;)

Anyone knows a fix for this?
 

PnoT

Dabbler
Joined
Apr 12, 2017
Messages
41
I've ran into an issue with the scripts that are included in this posting. If you have multiple services running (radarr / sonarr) and jackett installed at the same time and you issue a "service jackett stop" it will stop the other processes as well and not just itself.

EDIT

I fixed this by adding a poststart_cmd to find the PID of JackettConsole.exe and then writing that to my pidfile varible which avoids the problem above.

Code:
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: jackett
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable jackett:
# jackett_enable="YES"

. /etc/rc.subr

name="jackett"
rcvar=jackett_enable

load_rc_config $name
start_postcmd="${name}_poststart"
stop_postcmd="${name}_poststop"

: ${jackett_enable="NO"}
: ${jackett_user:="root"}
: ${jackett_data_dir:="/var/db/jackett"}

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

start_precmd="export XDG_CONFIG_HOME=${jackett_data_dir}"

jackett_poststart()
{
		echo `ps ax | grep "JackettConsole.exe" | grep -v grep | awk '{print $1}'` > $pidfile
}
jackett_poststop()
{
		rm $pidfile
}

run_rc_command "$1"

 
Last edited:

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I've ran into an issue with the scripts that are included in this posting. If you have multiple services running (radarr / sonarr) and jackett installed at the same time and you issue a "service jackett stop" it will stop the other processes as well and not just itself.

EDIT

I fixed this by adding a poststart_cmd to find the PID of JackettConsole.exe and then writing that to my pidfile varible which avoids the problem above.

Code:
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: jackett
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable jackett:
# jackett_enable="YES"

. /etc/rc.subr

name="jackett"
rcvar=jackett_enable

load_rc_config $name
start_postcmd="${name}_poststart"
stop_postcmd="${name}_poststop"

: ${jackett_enable="NO"}
: ${jackett_user:="root"}
: ${jackett_data_dir:="/var/db/jackett"}

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

start_precmd="export XDG_CONFIG_HOME=${jackett_data_dir}"

jackett_poststart()
{
		echo `ps ax | grep "JackettConsole.exe" | grep -v grep | awk '{print $1}'` > $pidfile
}
jackett_poststop()
{
		rm $pidfile
}

run_rc_command "$1"

maybe you could try letting daemon do this for you?
command_args="-f -p ${pidfile} ${procname} /usr/local/Jackett/JackettConsole.exe -d ${jackett_data_dir}"
 

PnoT

Dabbler
Joined
Apr 12, 2017
Messages
41
maybe you could try letting daemon do this for you?
command_args="-f -p ${pidfile} ${procname} /usr/local/Jackett/JackettConsole.exe -d ${jackett_data_dir}"

I'm still very new to these scripts and that looks like a much simpler solution. I'll give it a try.. thanks!
 

nasmart

Dabbler
Joined
Nov 28, 2016
Messages
13
I am looking for an easy way to install it too. Maybe someone registered to the bug tracker can add a feature request for a jackett jail or a sonarr+jackett jail?
 
Status
Not open for further replies.
Top