Skip to content

Instantly share code, notes, and snippets.

@GreenXenith
Created February 9, 2019 22:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GreenXenith/a0bdb9c4d6226c1de9a59415802c850f to your computer and use it in GitHub Desktop.
Save GreenXenith/a0bdb9c4d6226c1de9a59415802c850f to your computer and use it in GitHub Desktop.
Minetest Server Tester
#!/bin/bash
COUNT=0
while [[ $COUNT -ne 50 ]]; do
# Run minetest directly to server and free terminal input (&)
./minetest --go --address 123.456.78.9 --port 30000 --name 'LoadTester'$COUNT --password 'password123' &
# Record PID
PID=$!
sleep 0.5
# Get window id
while [ "$WID" == "" ]; do
WID=$(wmctrl -lp | grep $PID | cut "-d " -f1)
done
# Rename window (to avoid title conflicts on next id search - this could be done better)
wmctrl -r 'Minetest 5.0.0-dev-b7e1bca2-dirty [Main Menu]' -N 'LoadTester'$COUNT
# Unmaximize window and resize to 0
wmctrl -i -r $WID -b remove,maximized_vert; wmctrl -i -r $WID -b remove,maximized_horz;wmctrl -i -r $WID -e 0,0,0,0,0
# Increment and wait to not choke
((COUNT++))
sleep 3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment