#!/bin/bash
while true
do
sleep 1
minetestserver --config /path/to/your/minetest.conf \
--worldname name_of_your_world_here \
--gameid your_game_here \
--port 30000 \
--logfile /path/to/servers/debug.txt
done
VanessaE wrote:I use this (with stuff specific to my needs filled-in, of course):Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
#!/bin/bash
while true
do
sleep 1
minetestserver --config /path/to/your/minetest.conf \
--worldname name_of_your_world_here \
--gameid your_game_here \
--port 30000 \
--logfile /path/to/servers/debug.txt
done
Pretty simple stuff. It just loops, always waiting one second before restarting after a crash. Nothing fancy.
Note that something this simple can't protect against a server just locking up and consuming CPU - it'll only protect against the server crashing and exiting. For that, you'll need to write a script that scrapes the output from top or ps or something and measures how long the server stays in that state, then deliberately kills and restarts it if it exceeds some reasonable threshold.
VanessaE wrote:I use this (with stuff specific to my needs filled-in, of course):Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
#!/bin/bash
while true
do
sleep 1
minetestserver --config /path/to/your/minetest.conf \
--worldname name_of_your_world_here \
--gameid your_game_here \
--port 30000 \
--logfile /path/to/servers/debug.txt
done
Pretty simple stuff. It just loops, always waiting one second before restarting after a crash. Nothing fancy.
Note that something this simple can't protect against a server just locking up and consuming CPU - it'll only protect against the server crashing and exiting. For that, you'll need to write a script that scrapes the output from top or ps or something and measures how long the server stays in that state, then deliberately kills and restarts it if it exceeds some reasonable threshold.
Users browsing this forum: No registered users and 15 guests