mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-12-13 13:52:27 +00:00
2fb01b4adf
* Cherry-pick: Fixing AUTOPAUSE on Raspberry Pi 4s (#708) * implement autopause interface selection * concentrate ps calls in function file * wording and add note about PAPER's etc watchdogs
21 lines
467 B
Bash
Executable file
21 lines
467 B
Bash
Executable file
#!/bin/bash
|
|
|
|
. /start-utils
|
|
|
|
if [[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]] ; then
|
|
# save world
|
|
rcon-cli save-all >/dev/null
|
|
|
|
# wait until mc-monitor is no longer connected to the server
|
|
while :
|
|
do
|
|
if [[ -z "$(netstat -nt | grep "127.0.0.1:$SERVER_PORT" | grep 'ESTABLISHED')" ]]; then
|
|
break
|
|
fi
|
|
sleep 0.1
|
|
done
|
|
|
|
# finally pause the process
|
|
logAutopauseAction "Pausing Java process"
|
|
pkill -STOP java
|
|
fi
|