How do I autostart qbittorrent

Status
Not open for further replies.

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319
I was successful in portsnap'ing; make install; qbittorrent-nox from freshports to a standard jail.

(The reason is so that I can create my own private tracker - which qbittorrent is supposed to support but unfortunately the GUI does not have the advanced section so I'll need to find the configuration file - that's my next project.)

Anyways, qbittorrent runs great but only when I run the command qbittorrent-nox in the jail shell. I've done some reading and attempted to implement a few autostart batch files from the Internet but I have been unsuccessful.

Could someone please guide me in autostarting qbittorrent-nox when the jail starts, please.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
This question is outside the FreeNAS scope. You are better off asking how to auto-start a program for FreeBSD, in a FreeBSD forum. Then go into the jail and make the changes. I doubt it's that difficult but I know there are a few changes you will need to make in a few files and possibly create one file in order to accomplish what you want. Specifically I expect you to create a script and place it in /etc/rc.d which will call the program you want to run, then edit /etc/rc.conf to tell it to enable that script. Here is a link to a great example of what I used for MiniDLNA back in the FreeNAS 8.x and early 9.x days before Plugins worked. Please do not ask me questions about the code, there are a lot of examples on the internet and I actually think my code has enough info to make it self explanatory. The only thing to keep in mind is you need to be in your jail when doing these modifications.

http://forums.freenas.org/index.php?threads/minidlna-automatic-scan-fix.9312/

Good Luck

EDIT: I added a streamlined file here, call it "qbit" and you would need to change line 23 to whatever is proper to start your program.

Code:
#!/bin/sh
# File name 'qbit'
# Place this file into /etc/rc.d
# Edit /etc/rc.conf to include qbit_enable="YES"
 
. /etc/rc.subr
 
name="qbit"
rcvar=qbit_enable
 
PATH="$PATH:/usr/local/bin"
 
start_cmd="${name}_start"
stop_cmd=":"
 
load_rc_config $name
eval "${rcvar}=\${${rcvar}:-'NO'}"
 
qbit_start()
{
# And start up the service.
 
  service minidlna start
 
done
}
 
run_rc_command "$1"
 

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319
Awesome Joe! Thanks. That's what I was missing. I was putting the script in the wrong place. I wasn't placing it in the rc.d file and that was the error I was getting. Sorry for posting this question on these forums, I just assumed this was a general (and common) Linux command. Thank you for your time though! I'm building Gallery3 right now so I hope to get both of these up and running soon.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
You're welcome. If you do have a simple question, feel free to ask it but sometimes those simple ones could be major. The FreeBSD forums is the best place to get a good answer for this type of question as you won't see this type of talk here much.
 
Status
Not open for further replies.
Top