docker-mc-backup icon indicating copy to clipboard operation
docker-mc-backup copied to clipboard

[Question/suggestion] Is it possible to query the server for connected players without knocking?

Open Tonkari opened this issue 3 years ago • 8 comments

I am using PAUSE_IF_NO_PLAYERS, but on the minecraft server I enabled AUTOPAUSE to save on resources. Everytime the backup container checks for active players, the server gets knocked and spins up the java process, resulting in flooded logs and unnecessary resource consumption. I don't really know RCON, but would it be possible to avoid knocking the actual server or constructing a mechanism that filters knocks from the backup-container?

Tonkari avatar Nov 07 '21 20:11 Tonkari

Agreed, it doesn't seem good to wake up the server just to check the player count. I'll work on a pair of fixes to this and https://github.com/itzg/docker-minecraft-server/issues/1113

itzg avatar Nov 08 '21 16:11 itzg

I think it'll hit this current error log

https://github.com/itzg/docker-mc-backup/blob/542adc952008f91ce866167a6108c79b8e435ace/backup-loop.sh#L360

Every 5 minutes, by default. I wonder if I should just have that log the first time and debug log the others.

itzg avatar Nov 08 '21 16:11 itzg

Actually, this is trickier than I originally thought since the mc-monitor status here is contacting the regular 25565 port. (The "RCON" in RCON_HOST is confusingly not applicable.)

https://github.com/itzg/docker-mc-backup/blob/feeeceece1b4a3ca4307a00fa63dc4aef84c34c2/backup-loop.sh#L361

itzg avatar Nov 09 '21 02:11 itzg

Hi is there any update on this?

urwrstkn8mare avatar Apr 03 '22 23:04 urwrstkn8mare

After re-reading the original question the answer is a solid no. Of course you can't ask the minecraft server for a player count if the server is not active. I'm not sure why I thought rcon could violate the laws of physics.

itzg avatar Apr 04 '22 00:04 itzg

Is there a way it could detect if the server is paused or not? If the server is paused then you know there aren't players on it. Maybe the minecraft-server autopause can create an empty file in the server file named something like .paused. And then when the mc-backup sees that file in the server folder it'll stop until it detects the file is no longer there.

urwrstkn8mare avatar Apr 04 '22 20:04 urwrstkn8mare

I'm in the same situation. I'm using docker-minecraft-server with AUTOPAUSE and docker-mc-backup with PAUSE_IF_NO_PLAYERS.

Every 5 minutes the server are pausing and some minutes later the server are knocked by the backup check.

minecraft-0 | [Autopause loop] No client connected since startup / knocked - pausing minecraft-0 | [19:52:21] [RCON Listener #1/INFO]: Thread RCON Client /127.0.0.1 started minecraft-0 | [19:52:21] [Server thread/INFO]: [Rcon: Saved the game] minecraft-0 | [19:52:21] [RCON Client /127.0.0.1 #46/INFO]: Thread RCON Client /127.0.0.1 shutting down minecraft-0 | [2022-08-18T19:52:21+02:00] [Autopause] Pausing Java process minecraft-0 | [19:55:21] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 179432ms or 3588 ticks behind minecraft-0 | [Autopause loop] Server was knocked - waiting for clients or timeout minecraft-0 | [Autopause loop] No client connected since startup / knocked - pausing minecraft-0 | [19:57:22] [RCON Listener #1/INFO]: Thread RCON Client /127.0.0.1 started minecraft-0 | [19:57:22] [Server thread/INFO]: [Rcon: Saved the game] minecraft-0 | [19:57:22] [RCON Client /127.0.0.1 #47/INFO]: Thread RCON Client /127.0.0.1 shutting down minecraft-0 | [2022-08-18T19:57:22+02:00] [Autopause] Pausing Java process minecraft-0 | [20:00:21] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 178750ms or 3575 ticks behind minecraft-0 | [Autopause loop] Server was knocked - waiting for clients or timeout

Is there any idea how i can use both (AUTOPAUSE and PAUSE_IF_NO_PLAYERS) togehter?

hrolofs avatar Aug 18 '22 18:08 hrolofs

Thanks for commenting on this @hrolofs -- I had totally missed the suggestion from @samit43 , which sounds quite doable.

itzg avatar Aug 18 '22 23:08 itzg