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_user: minecraft
minecraft_group: minecraft minecraft_group: minecraft
minecraft_jar_url: https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar minecraft_jar_url: https://launcher.mojang.com/v1/objects/c5f6fb23c3876461d46ec380421e42b289789530/server.jar
minecraft_jar_checksum: sha256:80cf86dc2004ec6a2dc0183d1c75a9af3ba0669f7c332e4247afb1d76fb67e8a minecraft_jar_checksum: sha256:2902ed3ff84e4f810a2c0620c6b6df9c3ef8488b272c61274d5eac2433876f39
minecraft_opt_path: /opt/minecraft minecraft_opt_path: /opt/minecraft
minecraft_var_path: /var/opt/minecraft minecraft_var_path: /var/opt/minecraft

View File

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