Add rcon.py for running server commands (op, gamemode, etc)

No interactive console exists since lazymc/systemd run the server in
the background, and mcrcon isn't packaged for Debian 13. Plain
Python3 RCON client instead, reads the password straight from
server.properties. setup-server.sh now copies it into mcserver/.
This commit is contained in:
Mykhailo Ivanchenko
2026-10-23 15:55:43 +02:00
parent e510791746
commit 18ef303935
3 changed files with 67 additions and 0 deletions
+14
View File
@@ -37,6 +37,20 @@ Useful commands during the party:
- `sudo journalctl -u mc-lazymc -f` — watch it wake/sleep live
- `sudo systemctl restart mc-lazymc` — pick up new mods or a config change
### Running server commands (op, gamemode, whitelist, etc.)
The server has RCON enabled (`rcon.password` auto-generated in `mcserver/server.properties`), but there's no interactive console since lazymc/systemd run the Java process in the background. Use `mcserver/rcon.py` (plain Python3, no install needed — `mcrcon` isn't packaged for Debian 13):
```bash
ssh server
cd ~/lan-minecraft/repo/server/mcserver
python3 rcon.py "op <name>"
python3 rcon.py "gamemode creative <name>"
python3 rcon.py "op <name>" "gamemode creative <name>" # multiple commands in one call
```
Works for any server command — `list`, `whitelist add <name>`, `tp`, `weather clear`, `/chunky`-era commands if relevant, etc. The script reads the password straight from `server.properties`, nothing to copy/paste. Note it only works while the real server is awake — if lazymc has it asleep, wake it first (connect once, or `python3 rcon.py "list"` will just fail to connect).
### Resource sizing for the venue box (5–15 players)
Create is the dominant cost here — it's heavier on the server **tick thread (CPU)** than on RAM, because kinetic networks and contraptions get simulated every tick regardless of how many players are nearby. Farmer's Delight/its addons are cheap by comparison. Numbers below assume this modpack (~10 mods) and are *total host box* numbers, not just the JVM heap: