Created
October 31, 2025 19:27
-
-
Save Josakko/61002da3ca4d30e6e6e35df09e678045 to your computer and use it in GitHub Desktop.
mincraft server wrapper script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ram='8G' | |
| java_args=( ) | |
| file='server.jar' | |
| args=( '--nogui' "$@" ) | |
| java='java' | |
| # debug | |
| # echo "${args[@]}" | |
| # | |
| # echo "RUNNING WITH: ${java} -Xms${ram} -Xmx${ram} ${java_args[*]} -jar ${file} ${args[*]} " | |
| while true; do | |
| printf '\e[0;32mStarting server...\e[0m \n' | |
| "${java}" -Xms"${ram}" -Xmx"${ram}" "${java_args[@]}" -jar "${file}" "${args[@]}" | |
| for i in {3..1}; do | |
| printf '\e[0;33mServer restarting in %s... (CTRL-C to exit) \e[0m \n' "$i" | |
| sleep 1 | |
| done | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment