So I have spent around a month searching online and figuring out how to start a vanilla Minecraft server as soon ubuntu server boots, but I couldn't make it work.
Using Ubuntu Server 18.04LTS on Pentium G4560 with Intel 545s 512GB SSD with 8GB of RAM (its a physical box inside my basement so if for some reason direct access is needed)
Simply I have a Minecraft server instance in
/home/petar/Minecraft and a script that i can use manually to start it up
/home/username/petar/run.sh, what i found out is that you need a systemd service to run it so i made:
sudo nano /etc/systemd/system/vanilla-mc.service and it goes like this:
[Unit] Description=mc-vanilla-startup-service [Service] ExecStart=/home/petar/minecraft/run.sh [Install] WantedBy=multi-user.target
than i used sudo systemctl enable vanilla-mc.service and i rebooted my server after it booted i typed in systemctl status vanilla-mc.service and got:
vanilla-mc.service - mc-vanilla-startup-service Loaded: loaded (/etc/systemd/system/vanilla-mc.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2019-02-14 17:28:06 CET; 2h 36min ago Main PID: 969 (code=exited, status=1/FAILURE) Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
WHY IT DOESN'T WORK ???
BTW here is
./run.sh from minecraft folder:`
#!/bin/sh java -Xms1024M -Xmx3072M -jar server.jar -o true`
sorry for some reson i cant get formating to work correctly