Last active
March 9, 2022 00:54
-
-
Save ronoaldo/1b77c452e7ded870d4b82ae5209673dc to your computer and use it in GitHub Desktop.
Using minetest with tmux and systemd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
while true ; do | |
echo "Starting server ..." | |
minetestserver --terminal | |
echo "Server crashed/terminated. Restarting ..." | |
sleep 3 | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Start mercurio Minetest server | |
After=network.service | |
[Service] | |
Type=forking | |
User=ronoaldo | |
ExecStart=/usr/bin/tmux new-session -d -s mercurio /home/user/bin/minetest-run.sh | |
ExecStop=/usr/bin/tmux kill-session -t mercurio | |
MemoryAccounting=true | |
MemoryMax=1G | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add
minetest.service
do/lib/systemd/system
and enable withsystemctl enable minetest
.During boot, it will launch the server inside a tmux session and you can attach to it to diagnose or issue server commands from the terminal.
Enjoy!