From 8a5ddd5273a7732a8d7c2a027e20564331afba7c Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sat, 22 Aug 2020 10:00:35 -0500 Subject: [PATCH] minecraft 1.16.2 --- roles/minecraft/defaults/main.yaml | 4 ++-- roles/restic/files/hooks/minecraft.sh | 25 ++++++++----------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/roles/minecraft/defaults/main.yaml b/roles/minecraft/defaults/main.yaml index b45b217..f6212ef 100644 --- a/roles/minecraft/defaults/main.yaml +++ b/roles/minecraft/defaults/main.yaml @@ -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 diff --git a/roles/restic/files/hooks/minecraft.sh b/roles/restic/files/hooks/minecraft.sh index da8d175..81ebee4 100644 --- a/roles/restic/files/hooks/minecraft.sh +++ b/roles/restic/files/hooks/minecraft.sh @@ -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 }