💾 Archived View for gemini.susa.net › minetest_hacky_scripts.gmi captured on 2023-09-08 at 16:10:09. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-11-30)
-=-=-=-=-=-=-
The following are helper scripts to start and stop a Minetest server on Bash/GNU/Linux. They're totally hacky and sub-optimal, but they do their simple jobs.
#!/bin/bash MINETEST_HOME=~/minetest pgrep minetestserver >/dev/null && { echo "Stopping existing instance..."; killall -HUP minetestserver; sleep 2; } echo "Showing the current configuration" ~/config_summary.sh echo "Starting minetest server" ${MINETEST_HOME}/bin/minetestserver& MT_PID="$!" echo "Started server, PID ${MT_PID}"
#!/bin/bash MINETEST_HOME=~/minetest pgrep minetestserver >/dev/null && { killall -HUP minetestserver; sleep 2; } echo -e "\nMinetest server has been stopped"
#!/bin/bash MINETEST_HOME=~/minetest pgrep minetestserver >/dev/null && { killall -HUP minetestserver; sleep 2; } echo "Configuration of minetest.conf" egrep -v '^#|^ ${MINETEST_HOME}/minetest.conf cat ${MINETEST_HOME}/worlds/world/world.mt echo "Starting minetest server" ${MINETEST_HOME}/bin/minetestserver& MT_PID="$!" echo "Started server, PID ${MT_PID}"
It's handy to get a visual on the configuration when starting a server.
#!/bin/bash MINETEST_HOME=~/minetest echo -e "\nConfiguration of ${MINETEST_HOME}/minetest.conf" echo -e "============\n" egrep -v '^#|^ ${MINETEST_HOME}/minetest.conf WORLD_CONFIG="${MINETEST_HOME}/worlds/world/world.mt" echo -e "\nConfiguration of ${WORLD_CONFIG}" echo -e "============\n" cat ${WORLD_CONFIG}
Handy to take a snapshot of things before making significant changes (update
mods, etc).
It would be better to cd into ~/minetest and backup relative paths (an
excercise for the reader!).
!/bin/bash echo "Backing up all worlds to ~/worlds_all.tgz and ~/mods_global.tgz" ~/stop_minetest.sh tar cvzf ~/worlds_all.tgz ~/minetest/worlds tar cvzf ~/mods_global.tgz ~/minetest/mods ~/start_minetest.sh
From console mode (F10), invoke Lua directly. Get the object id (n) from the server's log when right clicking, for example.
The ObjectRef is a reference to a ServerActiveObject. Methods can be invoked on it as follows:
minetest.object_refs[n]:set_pos({x=100, y=10, z=100})