@sorcix
I tried implementing it with a systemd socket at first, but it seemed like it actually spawned a new instance of the server for every connection.
Maybe certain configuration could fix this, but the available documentation wasn't enough for me to make it do what I want. Eventually the netcat solution was born. :)
Search Criteria
Package Details: minecraft-server 1.21.3-1
Package Actions
Git Clone URL: | https://aur.archlinux.org/minecraft-server.git (read-only, click to copy) |
---|---|
Package Base: | minecraft-server |
Description: | Minecraft server unit files, script, and jar |
Upstream URL: | https://minecraft.net/ |
Keywords: | bash minecraft official script server |
Licenses: | custom |
Conflicts: | minecraft-canary, minecraft-server-systemd |
Submitter: | sorcix |
Maintainer: | edh |
Last Packager: | edh |
Votes: | 164 |
Popularity: | 0.073288 |
First Submitted: | 2010-11-29 15:52 (UTC) |
Last Updated: | 2024-10-23 19:51 (UTC) |
Dependencies (8)
- awk (gawk-gitAUR, busybox-coreutilsAUR, gawk)
- bash (bash-devel-static-gitAUR, bash-devel-gitAUR, busybox-coreutilsAUR, bash-gitAUR)
- java-runtime-headless (jre10AUR, jre12AUR, jdk10AUR, jdk10-openj9-binAUR, jdk7AUR, jre7AUR, amazon-corretto-16AUR, jdk16-adoptopenjdkAUR, jdk8-armAUR, liberica-jre-11-binAUR, jdk11-j9-binAUR, jre11-jbr-xdg-headlessAUR, jre16-openjdk-headlessAUR, jre14-openjdk-headlessAUR, jre15AUR, jre14AUR, jre13AUR, jre16AUR, jre18-openjdk-headlessAUR, amazon-corretto-19-binAUR, liberica-jre-11-full-binAUR, jdk13-openjdk-binAUR, liberica-jre-8-full-binAUR, jre-openj9-headlessAUR, jre12-openjdk-headlessAUR, jdk11-dragonwell-standard-binAUR, jdk11-jetbrains-binAUR, zulu-15-binAUR, jdk20-openj9-binAUR, zulu-13-binAUR, jdk8-dragonwell-extended-binAUR, jdk8-dragonwell-standard-binAUR, jdk11-dragonwell-extended-binAUR, jdk17-dragonwell-standard-binAUR, jre11AUR, jdk8-j9-binAUR, jdk7-j9-binAUR, jdk7r1-j9-binAUR, jre13-openjdk-headlessAUR, jre15-openjdk-headlessAUR, jdk8-openj9-binAUR, jre-ltsAUR, microsoft-openjdk-11-binAUR, microsoft-openjdk-17-binAUR, microsoft-openjdk-21-binAUR, liberica-nik-24-full-binAUR, zulu-17-binAUR, zulu-11-binAUR, zulu-8-binAUR, liberica-jdk-17-full-binAUR, liberica-jdk-11-lite-binAUR, liberica-jdk-11-full-binAUR, liberica-jdk-11-binAUR, jre19-openjdk-headlessAUR, jdk17-jetbrains-binAUR, zulu-jdk-fx-binAUR, zing-21-binAUR, zing-8-binAUR, jre17AUR, java-openjdk-binAUR, jre21-zulu-binAUR, amazon-corretto-17AUR, amazon-corretto-21-binAUR, jre17-zulu-binAUR, jdk21-temurinAUR, amazon-corretto-8AUR, amazon-corretto-11AUR, jdk11-temurinAUR, liberica-jdk-full-binAUR, liberica-jdk-21-full-binAUR, liberica-jdk-8-full-binAUR, jdk17-temurinAUR, zulu-21-binAUR, jdk-temurinAUR, jre8AUR, jdk8AUR, zulu-17-fx-binAUR, jdk8-perfAUR, zulu-jre-fx-binAUR, zulu-fx-binAUR, zulu8-fx-binAUR, zulu11-fx-binAUR, zulu17-fx-binAUR, zulu21-fx-binAUR, jdk-openj9-binAUR, jdk11-openj9-binAUR, jdk17-openj9-binAUR, jre-jetbrainsAUR, jre-openjdk-wakefield-headlessAUR, jre-openjdk-wakefieldAUR, jdk-openjdk-wakefieldAUR, jdk21-openj9-binAUR, zulu-23-binAUR, jreAUR, jdkAUR, jdk21-jetbrains-binAUR, java-openjdk-ea-binAUR, jre-zulu-binAUR, jre-zulu-fx-binAUR, jdk21-dragonwell-standard-binAUR, jdk21-dragonwell-extended-binAUR, jdk-openjdk, jdk11-openjdk, jdk17-openjdk, jdk21-openjdk, jre-openjdk, jre-openjdk-headless, jre11-openjdk, jre11-openjdk-headless, jre17-openjdk, jre17-openjdk-headless, jre21-openjdk, jre21-openjdk-headless, jre8-openjdk-headless)
- sed (busybox-coreutilsAUR, sed-gitAUR)
- sudo (fake-sudoAUR, polkit-fakesudoAUR, sudo-gitAUR, doas-sudo-shimAUR, doas-sudo-shim-minimalAUR, sudo-hgAUR, sudo-selinuxAUR, fudo-gitAUR)
- tmux (tmux-tcl-gitAUR, tmux-xdg-gitAUR, tmux-sixel-gitAUR, tmux-gitAUR)
- netcat (nmap-netcatAUR, openbsd-netcat-gitAUR, gnu-netcat-svnAUR, gnu-netcat, openbsd-netcat) (optional) – required in order to suspend an idle server
- tar (tar-gitAUR, busybox-coreutilsAUR) (optional) – needed in order to create world backups
Required by (0)
Sources (2)
Latest Comments
« First ‹ Previous 1 .. 11 12 13 14 15 16 17 18 19 20 21 .. 37 Next › Last »
melvinvermeeren commented on 2016-02-27 09:36 (UTC)
sorcix commented on 2016-02-27 09:03 (UTC)
Wouldn't it be better to implement this with a SystemD socket unit instead of a script?
edh commented on 2016-02-26 13:05 (UTC) (edited on 2016-02-26 13:05 (UTC) by edh)
Great, unless there are any complains I will proceed with finalizing the script and pushing it eventually.
@sowieso
Thanks for your suggestions! I addressed the netcat issue, switched the admittedly horrible IDLE_SERVER naming convetion in favor of true & false and print errors to stderr (don't know how I forgot about that) [1].
However concerning your shutdown problem I omitted killing the screen session bacause I think there is a underlying problem which should be observed instead. Stopping the server using game_command stop should quit java in the screen session and by that the screen session should close accordingly. If it does not do that the minecraft server is still up. Brutally closing it can therefore lead to data loss.
[1] https://gist.github.com/Edenhofer/2098815f0deda9dc6370
sowieso commented on 2016-02-26 11:00 (UTC)
I like the idea of adding an idle-server and would use it.
Some thoughts when looking at your posted script:
‣ Would be nice if you could also check for ›ncat‹, as I am using nmap's netcat implementation. Do the usual ›$NC_CMD arguments‹ trick, I suggest.
‣ I had a problem with the server not correctly shutting down (esp with the restart command). Solved it by adding:
$SUDO_CMD screen -S ${SESSION_NAME} -X quit
in server_stop() after ›game_command stop‹
‣ [[ ${IDLE_SERVER} == 0 ]] looks horrible (0 is true), I understand your reason, but why not simply check for a string like "true" or "enabled" or so.
‣ not important, but shouldn't error messages go to stderr (>&2)
edh commented on 2016-02-15 16:56 (UTC)
@melvinvermeeren
I made some first steps towards suspending the server. However I don't expect to be able to work on it again until next week. Therefore I am publishing the WIP here [1] for anyone who wants to inspect or improve the current state.
[1] https://gist.github.com/Edenhofer/2098815f0deda9dc6370
edh commented on 2016-02-11 19:31 (UTC) (edited on 2016-02-11 19:32 (UTC) by edh)
@melvinvermeeren
I like the idea. I will take a closer look at it in the near future.
melvinvermeeren commented on 2016-02-11 16:49 (UTC)
Hi guys,
Some friends of mine host a modded minecraft server on my server. Since modded minecraft servers like to eat a lot of CPU even if they're empty I created a script.
Upon first ping/connect the server will boot, if it's empty (by default minimal 5 minutes) it will stop itself and go back to awaiting connections.
Perhaps this type of socket-based activation is useful for others with CPU-eating modpacks too, so I'll share it here. Maybe it could be merged here somehow too. :)
https://git.mel.vin/melvin/scripts/blob/master/server/riskywhisky_minecraft.sh
Regards,
Melvin.
edh commented on 2016-01-27 17:38 (UTC)
@sowieso
I am well aware of how to properly update a package ;D
Though in this case it was NOT my intention for users having to rebuild the package. The introduced changes are purely cosmetic and don't change a thing on how this program works. The checksums should be fine, I updated them accordingly.
I guess one may consider this bad practise not increasing the pkgrel but adding some brackets where they are not needed for a nicer look, rewriting the installation note and not using sudo if the user is minecraft (which is discouraged!!!) are not worth the time a user has to spend to redownload and rebuild the package. This is an AUR pacakge not one from the official repo, the final package may differ from machine to machine anyway.
Btw. anyone may precisely follow what I have changed simply by going through the git history [1].
Considering the space-issue I still think that anyone who was able to install Arch Linux is aware of the bash syntax. Therefore using common knowledge should not only be more straightforward but also more user-friendly since it should be quite familiar.
[1] https://aur.archlinux.org/cgit/aur.git/log/?h=minecraft-server
sowieso commented on 2016-01-27 11:31 (UTC)
Thanks for merging. The changes are online on github, but you should also increase the pkgrel and checksums to actually distribute the update.
As for the $WORLDPATH, I would probably use a newline-delimited string or config file. Then I'd xarg this to tar. When I have the time I'll implement it and you can decide if you like it or not. Would at least be more user friendly than to manually escape all the spaces (things users could easily forget, esp when they are not familiar with bash syntax)
Pinned Comments
edh commented on 2016-06-18 18:24 (UTC) (edited on 2021-10-02 08:19 (UTC) by edh)
To get an overview of the available options provided by the management script, be sure to have a look at the help page or read the according section on the ArchWiki article [1].
You can quit the console without shutting down the server by press ctrl+a d (first ctrl+a and after releasing the buttons press d; ctrl+b also works). This will detach your input from the server console. The attaching and detaching is done with tmux (previously GNU screen) since it lets you view and type into the console, send single commands to it and keep it alive without a connected user. Take a look at the the command overview at the ArchWiki [2] to get a feel for its power. (@carmelo12341)
[1] https://wiki.archlinux.org/title/Minecraft#Setup [2] https://wiki.archlinux.org/title/Tmux