minecraft 1.16.2

This commit is contained in:
Ryan Cavicchioni 2020-08-22 10:00:35 -05:00
parent cfe9012e32
commit 8a5ddd5273
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
2 changed files with 10 additions and 19 deletions

View File

@ -11,8 +11,8 @@ minecraft_port: 25565
minecraft_user: minecraft
minecraft_group: minecraft
minecraft_jar_url: https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar
minecraft_jar_checksum: sha256:80cf86dc2004ec6a2dc0183d1c75a9af3ba0669f7c332e4247afb1d76fb67e8a
minecraft_jar_url: https://launcher.mojang.com/v1/objects/c5f6fb23c3876461d46ec380421e42b289789530/server.jar
minecraft_jar_checksum: sha256:2902ed3ff84e4f810a2c0620c6b6df9c3ef8488b272c61274d5eac2433876f39
minecraft_opt_path: /opt/minecraft
minecraft_var_path: /var/opt/minecraft

View File

@ -3,7 +3,7 @@
set -e
SERVICE=minecraft.service
VAR_DIR=/opt/minecraft/var
VAR_DIR=/var/opt/minecraft
WAIT=30
VERBOSE=${VERBOSE:-4}
@ -34,7 +34,6 @@ stop_server() {
return 0
fi
printf "stopping %s\n" "$instance"
systemctl -q stop "$unit"
while systemctl -q is-active "$unit"; do
@ -63,7 +62,6 @@ start_server() {
return 0
fi
printf "starting %s\n" "$instance"
systemctl -q start "$unit"
while ! systemctl -q is-active "$unit"; do
@ -78,7 +76,6 @@ start_server() {
return 0
}
open_files() {
local dir=${1-$VAR_DIR}
local attempts="${2:-$WAIT}"
@ -95,28 +92,22 @@ open_files() {
return 0
}
main() {
if [ "$1" == "pre" ]; then
for path in "$VAR_DIR"/*; do
instance="minecraft@$(basename "$path").service"
if ! stop_server "$instance"; then
error_exit "Failed to stop $instance"
fi
done
if ! stop_server $SERVICE; then
error_exit "Failed to stop $SERVICE"
fi
printf "checking for open files\n"
if ! open_files $VAR_DIR; then
error_exit "Open files exist in $VAR_DIR"
fi
elif [ "$1" == "post" ]; then
for path in "$VAR_DIR"/*; do
instance="minecraft@$(basename "$path").service"
if ! start_server "$instance"; then
error_exit "Failed to start $instance"
fi
done
if ! start_server $SERVICE; then
error_exit "Failed to start $SERVICE"
fi
fi
}