Skip to content

Instantly share code, notes, and snippets.

@rubenwardy rubenwardy/
Last active May 21, 2018

What would you like to do?
Auto-restart, log per season, email on crash
cd ~/.minetest
mkdir -p logs_ctf
function mailme() {
echo "To:" > mail.txt
echo "Subject: CTF server crashed" >> mail.txt
echo "From:" >> mail.txt
echo "" >> mail.txt
tail -n 5 $1 >> mail.txt
tail "======" >> mail.txt
tail -n 300 $1 >> mail.txt
sendmail -vt < mail.txt
while true
DATE=$(date +%Y_%m_%d_%H_%M_%S)
echo "----------------------" >>$MOREDEBUG
echo "Server restarted at "`date` >>$MOREDEBUG
echo "----------------------" >>$MOREDEBUG
~/minetest_stable/bin/minetestserver \
--logfile logs_ctf/debug_$DATE.txt \
--world ./worlds/ctf \
--gameid capturetheflag \
--config minetest_ctf.conf || mailme logs_ctf/debug_$DATE.txt
sleep 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.