Managing several MC Java servers on a RaspberryPi is troublesome. So I write this launcher to make things easier.
Users can define their path to the directory which holds Minecraft instances (Let's call it "Minecraft folder" hereafter) on the first launch. Minecraft folder is also where I put the lock file, which contains the path to the currently running Minecraft server instance.
The launcher needs to write a config file in ~/.minecraft and reads it on every launch.
The launcher manages instances using systemctl
, for it's easier to control how the server would start and stop seprately using corresponding .service
file.
Examples can be found in the repo.
Inside each instance folder, a text file named service
is needed, it should contain the name of the .service
file.
I use screen
to hold Minecraft server console so that historical information will be kept for later use.
Note that .service
file should be put in /etc/systemd/system
and always do
systemctl daemon-reload
after modifying files in /etc/systemd/system
.
Up to v0.16, the lock files are generated by the script called during the Minecraft launching process, not by the launcher itself. In future versions, I will attempt to have the launcher handle the creation of lock files.
Frankly speaking, the script was initially only a try to get my hands on shell scripts, and it's also my debut piece with (hopefully) practical value, so don't get mad about its imperfections.
Should any question arise, be free to open an issue. And any new idea or advice on coding is always welcome.
Last but not least: I am not a native English speaker, so if there's any typo or poor / confusing expression, please let me know.
Open a terminal and run:
wget -O <your/path/to/minecraft/folder>/minecraft.sh https://raw.githubusercontent.com/Charles-IX/RaspberryPi_MC_launcher/main/minecraft.sh
Then cd
to your Minecraft folder:
cd <your/path/to/minecraft/folder>
And give the script right permission:
chmod +x minecraft.sh
Finally run:
./minecraft.sh
Once you have finished the OOBE first launch process, you can simply do:
mc
Once you have finished the OOBE first launch process, you can simply do:
mc -u
v0.20:
- The script can read server list from server.sh in the Minecraft folder.
v0.18:
- Added the function to handle parameters like '-h' or '-u'.
v0.16:
- Enabled the launcher to upgrade itself when a newer version is detected in the Minecraft directory.
- Users can now customize their Minecraft directory on first launch.
- The script can no longer be run as root to prevent unpredictable failures.
v0.15:
- Now the launcher would handle all situations where Minecraft services malfunction. In this case, a new debug option "show logs" is added, allowing user to check what happened during the last screen session.
v0.14:
- Now the launcher would handle the situation where Minecraft services go into "failed" state.
v0.12:
- Added the lock file.
- It will no longer ask user to choose a server to run when a server is already running, instead, it will show information about the running server.
v0.10:
- The initial version of the project.
- Its only function is listing the servers and allows the user to choose which to run.