Skip to content

Instantly share code, notes, and snippets.

@nosmall
Last active June 22, 2020 09:45
Show Gist options
  • Save nosmall/fe95bab8180cce858ab4 to your computer and use it in GitHub Desktop.
Save nosmall/fe95bab8180cce858ab4 to your computer and use it in GitHub Desktop.
(simple) TrinityCore (linux (Debian)) restarter (using a bashscript) for posterus.cz
# (simple) TrinityCore (linux (Debian)) restarter (using a bashscript) for posterus.cz
# required applications
# sudo apt-get update && sudo apt-get install screen mutt gdb
# INFO
# ./_restarter > Starts the world server with restarter
# ./_auth_starter > Starts the auth server without restarter
# ./_world_starter > Starts the world server without restarter
# Sending Email With Attachments (CRASH REPORT)
# Edit "[email protected]" in file "_restarter-bin" (Row 27)
# Another way: https://gist.github.com/Lillecarl/5421446
#! /bin/bash
screen -A -m -d -S authserver ./authserver
#! /bin/bash
screen -A -m -d -S worldserver ./_restarter-bin
#! /bin/bash
DIRPATH=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd -P)
echo $DIRPATH
cd $DIRPATH
echo "run" > gdbcommands
echo "shell echo -e \"\nCRASHLOG BEGIN\n\"" >> gdbcommands
echo "info program" >> gdbcommands
echo "shell echo -e \"\nBACKTRACE\n\"" >> gdbcommands
echo "bt" >> gdbcommands
echo "shell echo -e \"\nBACKTRACE FULL\n\"" >> gdbcommands
echo "bt full" >> gdbcommands
echo "shell echo -e \"\nTHREADS\n\"" >> gdbcommands
echo "info threads" >> gdbcommands
echo "shell echo -e \"\nTHREADS BACKTRACE\n\"" >> gdbcommands
echo "thread apply all bt full" >> gdbcommands
chmod +x gdbcommands
while :
do
echo "starting worldserver";
./worldserver
NOW=$(date +"%s-%d-%m-%Y")
mkdir -p $DIRPATH/log && mkdir -p $DIRPATH/log/crashes
gdb $DIRPATH/worldserver --batch -x gdbcommands | tee currentcrash
mv currentcrash $DIRPATH/log/crashes/$NOW.log &>/dev/null
echo "$(date +"%T %d-%m-%Y") SERVER CRASHED !!! Full report in attachment, crashlog available at: $DIRPATH/log/crashes/$NOW.log" | mutt -a "$DIRPATH/log/crashes/$NOW.log" -s "$(date +"%T %d-%m-%Y") / WorldServer CRASH REPORT" -- [email protected]
find log/crashes/ -type f -mtime 3 -exec rm -f {} \;
echo "worldserver stopped";
sleep 1
done
#! /bin/bash
screen -A -m -d -S worldserver ./worldserver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment