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:
minecraftctlminecraft@.service
- Create a unix user and group
minecraft- You can use different a java version, working directory, user and group names; adjust
minecraft@.service'sEnvironment="JAVA_RUNTIME=",WorkingDirectory=,User=andGroup=settings
- You can use different a java version, working directory, user and group names; adjust
- Put
minecraft@.serviceinto/etc/systemd/system/ - Put
minecraftctlinto/usr/local/bin/and ensure it is executable by everyone and owned by root- You can put
minecraftctlsomewhere else, but you then need to adjust theSAFE_SELFconstant 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_NAMEconstants accordingly
- You can put
- Create a sudoers entry to allow users or a group of your choice to execute
minecraftctlwith elevated permissions
minecraftctl: show helpminecraftctl console <server-id>: open the console of the server with given id, UseCtrl+afollowed bydto 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-downloadpaper-downloadtuinity-download
- Put
spigot-downloadinto/usr/local/bin/and ensure it is executable by everyone - Put
paper-downloadinto/usr/local/bin/and ensure it is executable by everyone - Put
tuinity-downloadinto/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
jqon 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.serviceminecraft-ramdisk.timerminecraft-ramdisk.service
- Put
minecraft-ramdisk-prepare.service,minecraft-ramdisk.timerandminecraft-ramdisk.serviceinto/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.shprocess-userjoins.r
- Ensure you have
bashinstalled - Put
userjoins.shandprocess-userjoins.rsomewhere 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
readrandtibble - Or the complete
tidyverselibrary
- 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.rwill fails, as the script can't differentiate between the oldanalysis.csvand the input data. - If you don't specify the log directory to
userjoins.shit will assume../logsby default. - You can adjust the logging level of
userjoins.shby setting theLOG_LEVELenvironment variable:Valid levels are:LOG_LEVEL=2 userjoins.sh /path/to/logs
0forDEBUG1forINFO2forWARNING3forSEVERE
- To set a custom time zone set the
TIMEZONEenvironment variable:The default is the system's time zone.TIMEZONE='+05:30' userjoins.sh /path/to/logs