#!/bin/bash # Send an RCON command to a Minecraft server # Usage: mc-rcon.sh [port] [password] set -euo pipefail CMD="${1:?Usage: mc-rcon.sh [port] [password]}" PORT="${2:-25575}" PW="${3:-test123}" python3 -c " import socket, struct, sys s = socket.socket() s.settimeout(5) try: s.connect(('localhost', $PORT)) except Exception as e: print(f'Connection failed: {e}', file=sys.stderr) sys.exit(1) def send(req_id, pkt_type, body): body = body.encode() s.send(struct.pack('