Skip to content

Instantly share code, notes, and snippets.

@nosmall
Created May 31, 2016 07:33
Show Gist options
  • Save nosmall/251688b9696c2049c3c353ab6328e944 to your computer and use it in GitHub Desktop.
Save nosmall/251688b9696c2049c3c353ab6328e944 to your computer and use it in GitHub Desktop.
Team Speak 3 Crash Reporter & Restarter / TS3 Restarter & Crash Reporter / Ubuntu 14.04
1) sudo apt-get update && sudo apt-get install screen mutt p7zip-full
2) Set SCREENNAME and MAILREPORT and ADMINEMAIL in crashreporter.sh
3) CREATE CRON JOB and run script LIKE * * * * * bash /var/TeamSpeak3/crashreporter.sh >/dev/null 2>&1
#!/bin/bash
SCREENNAME="ts3srv"
MAILREPORT=0
ADMINEMAIL="[email protected]"
# SCRIPT
DIRPATH=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd -P)
TEAMSPEAK=`ps ax | grep ts3server | grep -v grep | wc -l`
if [ "$TEAMSPEAK" -eq 0 ]
then
cd $DIRPATH
# create logs.zip
mkdir -p logs && rm -f logs.zip && 7z a logs.zip logs/*.log
# restart server
screen -S $SCREENNAME -X quit
screen -A -m -d -S $SCREENNAME ./ts3server_minimal_runscript.sh inifile=ts3server.ini
if [ "$MAILREPORT" -eq 1 ] ; then
# send crash report
echo "$(date +"%T %d-%m-%Y") TS3 SERVER CRASHED - Full report in attachment, crashlog available at: $DIRPATH" | mutt -a "$DIRPATH/logs.zip" -s "$(date +"%T %d-%m-%Y") / TS3 Server CRASH REPORT" -- $ADMINEMAIL
fi
# delete old zip file
rm -f logs.zip
else
exit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment