Running a Minecraft Server in a Jail, unable to start it outside of the Shell.

JLar_

Cadet
Joined
Apr 5, 2021
Messages
4
I am pretty new to TrueNAS, and by pretty new I mean I had never used it once before yesterday. I built a NAS for a Plex Server and a Minecraft Server, and I've managed to get the Plex Server setup no problem with the plugin. I was originally using the MineOS plugin for the Server, but I found it very limiting and slow, so I tried finding a new way to do it.

I followed this video exactly to install a Server in a Jail:

So now if I run minecraft-server in my Shell, the Server starts up and works perfectly, it runs really well and everything. But the problem is, it shuts down as soon as I exit the Shell. The whole point of running this Server on a NAS is so that it can run 24/7, I don't have to have my PC on for it to be online, and this kind of defeats that whole purpose.

If this has already been answered somewhere else I apologize for the duplicate question, but I have literally been trying to get this Server up for the past 14 hours straight and I still can't fix the issue. I've made progress, but I'm just stuck on this last part.

Like I said, all I need to do to start the Server is go into the Shell and run minecraft-server. I don't need to specify a directory or anything like that, just that simple command starts it up. I read all about rc.d files and how they're coded, and made a minecraftd file that I put in both /root/etc/rc.d and /root/usr/local/etc/rc.d because I didn't know which one it should go in. I also made sure to add minecraftd_enable="YES" to my rc.conf file in /root/etc/. I have attached both files as .txt's.

The script itself in minecraftd works fine, the Server will also start if I run the file with /usr/local/etc/rc.d/minecraftd onestart.

But again, the issue is that I have to be in the Shell for the Server to start. "minecraftd" is supposed to start when the Jail itself starts, so the Server will automatically run without me having to do anything. I feel like there has to be some way to do this, some small thing I must be missing, some dumb reason why this won't work.

If there's any help anyone can offer me, it would be very, very appreciated.
 

Attachments

  • minecraftd.txt
    235 bytes · Views: 247
  • rc.conf.txt
    422 bytes · Views: 247

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
I'd recommend using MineOS and Supervisord.


You will need to tweak the package names a bit, that howto is just a little bit outdated. But I can assure you it works.
 

JLar_

Cadet
Joined
Apr 5, 2021
Messages
4
Thank you so much for your suggestion!

I decided to try just using Supervisord with what I already have before attempting MineOS again, and after a few hours, I've got Supervisord setup so my Server can run without the shell needing to be open. Seriously thanks so much! Though I do have one more thing I'd like to know how do, if you know how to do it.

At the moment, I just have to open the Shell, run /usr/local/bin/supervisord, wait a little, and then my server is up and I can exit the shell. It's not the worst thing in the world, but ideally I'd like supervisord to start just with the jail itself, so I don't have to do anything at all on my end. I found a script for a supervisord file to put in rc.d, and added the whole "supervisord_enable="yes" to the rc.conf file, but it doesn't automtically start when starting the Jail. Do you know how to do it?
 

Attachments

  • supervisord.txt
    423 bytes · Views: 268

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
What do you mean by "I found a script"? You should of course install the standard FreeBSD supervisord package by the means of pkg install. This will also install a start script and with the supervisord_enable setting active it will start whenever your jail starts.

Edit: it's pkg install py37-supervisor
 

JLar_

Cadet
Joined
Apr 5, 2021
Messages
4
I just googled how to make supervisord start with Jail and found a result where someone had typed up a script for the supervisord file. But ohhh okay, I installed it using the directions from the website, which said to use pip install supervisor. Since I've got everything working now and I don't want to mess it up, I'm just going to leave it the way it is, but thank you again for your help! If I decide I want to fix this in the future I'll make sure to use that command to install supervisor.
 
Top