Full path to mcstatus

This commit is contained in:
2020-07-22 22:03:37 +00:00
parent 81d41f0885
commit f6ed84608b

View File

@@ -36,7 +36,6 @@ soft_poweroff() {
echo "Time to live is $(cat "$LIVE_UNTIL")" echo "Time to live is $(cat "$LIVE_UNTIL")"
if [ "$(date +%s)" -ge "$ttl" ]; then if [ "$(date +%s)" -ge "$ttl" ]; then
echo "Server empty longer than grace time, shutting down" echo "Server empty longer than grace time, shutting down"
empty_reset # Needs to be 0 next time server starts
tmux send-keys -t "$TMUX_NAME.0" "stop" ENTER tmux send-keys -t "$TMUX_NAME.0" "stop" ENTER
sleep 5 sleep 5
$(sudo /sbin/shutdown -P +1) $(sudo /sbin/shutdown -P +1)
@@ -49,7 +48,7 @@ tmux_running() {
} }
server_responsive() { server_responsive() {
silent_exitcode mcstatus localhost ping silent_exitcode /usr/local/bin/mcstatus localhost ping
} }
n_logins="$(w -h | wc -l)" n_logins="$(w -h | wc -l)"
@@ -68,7 +67,7 @@ else
fi fi
if server_responsive; then if server_responsive; then
n_players=$(mcstatus localhost json | json_parse player_count) n_players=$(/usr/local/bin/mcstatus localhost json | json_parse player_count)
echo "Server responsive. $n_players players online" echo "Server responsive. $n_players players online"
if [ "$n_players" -gt 0 ]; then if [ "$n_players" -gt 0 ]; then
# Keep alive as players are online # Keep alive as players are online