2020-05-20 13:17:58 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-05-23 14:15:10 +00:00
|
|
|
. /start-utils
|
2022-07-30 17:06:22 +00:00
|
|
|
if isTrue "${DEBUG_AUTOPAUSE}"; then
|
|
|
|
set -x
|
|
|
|
fi
|
2020-05-23 14:15:10 +00:00
|
|
|
|
2020-12-31 19:15:44 +00:00
|
|
|
if [[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]] ; then
|
2020-05-20 13:17:58 +00:00
|
|
|
# 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
|
2020-05-23 14:15:10 +00:00
|
|
|
logAutopauseAction "Pausing Java process"
|
2020-12-31 19:15:44 +00:00
|
|
|
pkill -STOP java
|
2020-05-20 13:17:58 +00:00
|
|
|
fi
|