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.

PS I'm posting this at like 4am before I go to sleep, I'm not expecting anyone to respond quickly but if someone does I'll be checking this as soon as I wake up
 

Attachments

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

tharris5109

Cadet
Joined
Feb 4, 2017
Messages
0
You might find using screen easier than working with services. screen lets you start a terminal and leave it running without having to remain connected via SSH.

In the jail console, install screen:

pkg install screen

Then simply run screen and you'll get a terminal that will continue running, even if you disconnect from SSH. From there, you can run your startup script. To exit the terminal whilst leaving it running, press CTRL + A, then press D. To reattach to the terminal, run screen -r.

You might then be able to make it start automatically by using cron to run your startup script in screen.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Solved in this thread:
 
Top