Helper scripts to do various things.
You should never trust these scripts, as with all scripts on the Internet. Double-check them and use them at your own risk.
Run your Minecraft server as non-privileged user inside a screen managed by systemd, so it starts on server-startup and
stops on server shutdown. Allows as many servers as you like to run in parallel. minecraftctl
offers starting and
stopping servers, creating new instances and opening the terminal by multiple users in parallel.
Inside folder systemd/screen/minecraft/multiple
:
minecraftctl
[email protected]
- Create a unix user and group
minecraft
- You can use different a java version, working directory, user and group names; adjust
[email protected]
'sEnvironment="JAVA_RUNTIME="
,WorkingDirectory=
,User=
andGroup=
settings
- You can use different a java version, working directory, user and group names; adjust
- Put
[email protected]
into/etc/systemd/system/
- Put
minecraftctl
into/usr/local/bin/
and ensure it is executable by everyone and owned by root- You can put
minecraftctl
somewhere else, but you then need to adjust theSAFE_SELF
constant inside the script - You need to set the same environment as defined in your service file; adjust
minecraftctl
'sWORKING_DIRECTORY=
,MINECRAFT_USER=
andSYSTEMD_UNIT_NAME=
andSCREEN_NAME
constants accordingly
- You can put
- Create a sudoers entry to allow users or a group of your choice to execute
minecraftctl
with elevated permissions
minecraftctl
: show helpminecraftctl console <server-id>
: open the console of the server with given id, UseCtrl
+a
followed byd
to closeminecraftctl start <server-id>
: start the server with given idminecraftctl stop <server-id>
: stop the server with given idminecraftctl restart <server-id>
: restart the server with given idminecraftctl status <server-id>
: show the status of the server with given idminecraftctl enable <server-id>
: enable the server with given id to be started automatically on system bootminecraftctl disable <server-id>
: disable the server with given id to be no longer started automatically on system bootminecraftctl create <server-id> <executable>
: create a new server instance with given id and executable
Download or compile the latest or a specific build of bukkit, spigot, paper or tuinity server.
spigot-download
will create additional folders and files, you might want to execute it in its own folder.
Inside folder downloader
:
spigot-download
paper-download
tuinity-download
- Put
spigot-download
into/usr/local/bin/
and ensure it is executable by everyone - Put
paper-download
into/usr/local/bin/
and ensure it is executable by everyone - Put
tuinity-download
into/usr/local/bin/
and ensure it is executable by everyone - You might want to create a symlink for
bukkit-download
:ln -sf -T spigot-download bukkit-download
- Install
jq
on your system (for paper and tuinity, optional for bukkit and spigot) - Install
git
(for bukkit and spigot)
spigot-download
: compile bukkit and spigot for the latest minecraft version availablespigot-download <minecraft-version>
: compile bukkit and spigot for the given minecraft versionpaper-download
: download latest paper build of the latest minecraft version availablepaper-download <minecraft-version>
: download latest paper build of the given minecraft versionpaper-download <minecraft-version> <build>
: download the given paper build of the given minecraft versiontuinity-download
: download latest tuinity build availabletuinity-download <build>
: download the given tuinity build
Put your worlds into a ramdisk for faster load and save times.
Inside folder world-ramdisk
:
minecraft-ramdisk-prepare.service
minecraft-ramdisk.timer
minecraft-ramdisk.service
- Put
minecraft-ramdisk-prepare.service
,minecraft-ramdisk.timer
andminecraft-ramdisk.service
into/etc/systemd/system/
- Adjust paths inside both service units to match your world storage
- Tell your server to use the worlds inside your ramdisk
- Either use
--world-dir /dev/shm/minecraft/
if your server supports it - Or create symlinks to your worlds from the server directory to the shared memory worlds
- Either use
Analyse minecraft server logs to extract some information.
Inside folder logfile-analysis
:
userjoins.sh
process-userjoins.r
- Ensure you have
bash
installed - Put
userjoins.sh
andprocess-userjoins.r
somewhere you have easy access (e.g.~/.bin/
or/usr/local/bin/
) and ensure it is executable- I don't recommend installing it globally, but it is possible and won't break anything
- Install R on your system
- If you analyze files on a remote server you might want to install R locally instead
- Required R libraries:
- Either
readr
andtibble
- Or the complete
tidyverse
library
- Either
- Create a directory for analysis files (e.g.
mkdir -p ~/server/analytics
) - Change directory into your analysis folder (e.g.
cd ~/server/analytics
) - Execute
userjoins.sh <log dir>
(e.g.~/.bin/userjoins.sh ../logs/
) - If you want to download all files, pack them:
tar -czf analysis.tar.gz *.csv
- Execute
process-userjoins.r
(e.g.~/.bin/process-userjoins.r
) - The R script writes the output to
analysis.csv
- Note that consecutive executions of
process-userjoins.r
will fails, as the script can't differentiate between the oldanalysis.csv
and the input data. - If you don't specify the log directory to
userjoins.sh
it will assume../logs
by default. - You can adjust the logging level of
userjoins.sh
by setting theLOG_LEVEL
environment variable:Valid levels are:LOG_LEVEL=2 userjoins.sh /path/to/logs
0
forDEBUG
1
forINFO
2
forWARNING
3
forSEVERE
- To set a custom time zone set the
TIMEZONE
environment variable:The default is the system's time zone.TIMEZONE='+05:30' userjoins.sh /path/to/logs