Jump to content

Starting Minecraft Server on Startup

Hi All, 

 

I"m a complete linux CLI noob, but trying to set up a minecraft server for my little brother. 

Everything works fine, however, I have to SSH in and run the startup script (via start.sh found here), however, this closes if I close SSH. 

 

I tried following this tutorial, however, it's not worked. 

Could someone provide me with a fool proof way of getting to start the server. 

 

Currently, my rc.local looks like this: 

 

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

/home/pi/Minecraft_Server/./start.sh &

exit 0



 

Thanks, 

 

Link to comment
Share on other sites

Link to post
Share on other sites

This doesn't directly answer your question, but if you are using Ubuntu Server, I recommend something called "screen". Allows you to save and return to SSH sessions even after you've disconnected/reconnected.

Quote me to see my reply!

SPECS:

CPU: Ryzen 7 3700X Motherboard: MSI B450-A Pro Max RAM: 32GB I forget GPU: MSI Vega 56 Storage: 256GB NVMe boot, 512GB Samsung 850 Pro, 1TB WD Blue SSD, 1TB WD Blue HDD PSU: Inwin P85 850w Case: Fractal Design Define C Cooling: Stock for CPU, be quiet! case fans, Morpheus Vega w/ be quiet! Pure Wings 2 for GPU Monitor: 3x Thinkvision P24Q on a Steelcase Eyesite triple monitor stand Mouse: Logitech MX Master 3 Keyboard: Focus FK-9000 (heavily modded) Mousepad: Aliexpress cat special Headphones:  Sennheiser HD598SE and Sony Linkbuds

 

🏳️‍🌈

Link to comment
Share on other sites

Link to post
Share on other sites

I'd recommend setting it up as a service using systemd:

- https://minecraft.gamepedia.com/Tutorials/Server_startup_script

- https://teilgedanken.de/Blog/post/setting-up-a-minecraft-server-using-systemd/

 

Then you can configure it to start as soon as the server is started and you don't have to sign in to run it manually

 

 

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks, will try this out in the morning and repeat back. 

 

J :)

Link to comment
Share on other sites

Link to post
Share on other sites

10 hours ago, Junel said:

Hi All, 

 

I"m a complete linux CLI noob, but trying to set up a minecraft server for my little brother. 

Everything works fine, however, I have to SSH in and run the startup script (via start.sh found here), however, this closes if I close SSH. 

 

I tried following this tutorial, however, it's not worked. 

Could someone provide me with a fool proof way of getting to start the server. 

 

Currently, my rc.local looks like this: 

 


# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

/home/pi/Minecraft_Server/./start.sh &

exit 0



 

Thanks, 

 

Alternatively you can also use cron to schedule it on startup.

Link to comment
Share on other sites

Link to post
Share on other sites

I would strongly recommend using systemd for this task.

1. Create the file /etc/systemd/system/minecraft.service :

Spoiler

touch /etc/systemd/system/minecraft.service

2. Open Nano to edit the file:

Spoiler

nano /etc/systemd/system/minecraft.service

3. Fill in the following content and replace the path and user:

Spoiler

[Unit]
Description=Minecraft server
After=network.target

[Service]
Type=simple
ExecStart=/PATH/TO/START.SH
User=USER

[Install]
WantedBy=multi-user.target

4. Save and close

5. Reload SystemD:

Spoiler

systemctl daemon-reload

6. Enable the unit for autostart:

Spoiler

systemctl enable minecraft

7. Start the server:

Spoiler

systemctl start minecraft

8. Enjoy!

 

Sorry for not using code blocks, wrote this on my phone and couldn't find an option to add some. Also, there might be some typing mistakes, again cause of me writing this on my phone. If you have any problems, feel free to ask!

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×