#!/bin/bash
screen -A -m -d -S restarter ./restarter-bin
restarter-bin:
#!/bin/bash
######################
GDB_ENABLED=1
GDB="trinity.gdb"
WORLDSERVER="world.pid" ### Put here the pid you configured on your worldserver.conf file ###
AUTHSERVER="auth.pid" ### Put here the pid you configured on your authserver.conf file ###
### If you want to have more realms runing, just uncoment or copy this line ###
# EXTRAWORLDSERVER="world.pid" ### Put here the pid you configured on your worldserver.conf file ###
WORLD_CONFIG="../etc/worldserver.conf"
REALM_CONFIG="../etc/authserver.conf"
### If you want to have more realms runing, just uncoment or copy this line ###
# EXTRAWORLD_CONFIG="../etc/extraworldserver.conf"
WORLD_SCREEN_NAME="world"
REALM_SCREEN_NAME="realm"
### If you want to have more realms runing, just uncoment or copy this line ###
# EXTRAWORLD_SCREEN_NAME="world"
TRACE_BEGIN_STRING="SIGSEGV"
TRACE_FILE="trace.log"
ERR_FILE="error.log"
SYSLOG="system.log"
SYSERR="system.err"
LINKS_FILE="crash_links.link"
######################
function checkStatus() {
if [ -d "/proc/"$1 ]; then
eval "TEST=1"
else
eval "TEST=0"
fi
}
while :
do
PID=$(cat $WORLDSERVER)
checkStatus $PID
if [ $TEST -eq 0 ]; then
DATE=$(date)
echo "Restarting Trinity Core blizz($DATE)"
if [ $GDB_ENABLED -eq 1 ]; then
grep -B 10 -A 1800 "$TRACE_BEGIN_STRING" "$SYSLOG" >> "$TRACE_FILE"
echo "------------------`date+%Y-%m-%d-%H-%M-%S`------------------" >> "$TRACE_FILE"
cat "$TRACE_FILE" | ./paster | grep "http" >> "$LINKS_FILE"
cat "$SYSERR" > "$ERR_FILE"
screen -A -m -d -S $WORLD_SCREEN_NAME ./start worldserver $GDB "$WORLD_CONFIG" "$SYSLOG" "$SYSERR" 1
fi
if [ $GDB_ENABLED -eq 0 ]; then
screen -A -m -d -S $WORLD_SCREEN_NAME ./start worldserver null "$WORLD_CONFIG" null null 0
fi
fi
### If you want to have more realms runing, just uncoment or copy those lines ###
# PID=$(cat $EXTRAWORLDSERVER)
# checkStatus $PID
# if [ $TEST -eq 0 ]; then
# DATE=$(date)
# echo "Restarting Trinity Core blizz($DATE)"
# if [ $GDB_ENABLED -eq 1 ]; then
# grep -B 10 -A 1800 "$TRACE_BEGIN_STRING" "$SYSLOG" > "$TRACE_FILE"
# cat "$TRACE_FILE" | ./paster | grep "http" >> "$LINKS_FILE"
# cat "$SYSERR" > "$ERR_FILE"
# screen -A -m -d -S $EXTRAWORLD_SCREEN_NAME ./start worldserver $GDB "$EXTRAWORLD_CONFIG" "$SYSLOG" "$SYSERR" 1
# fi
#
# if [ $GDB_ENABLED -eq 0 ]; then
# screen -A -m -d -S $EXTRAWORLD_SCREEN_NAME ./start worldserver null "$EXTRAWORLD_CONFIG" null null 0
# fi
# fi
PID=$(cat "$AUTHSERVER")
checkStatus $PID
if [ $TEST -eq 0 ]; then
DATE=$(date)
echo "Restarting Trinity Realm ($DATE)"
screen -A -m -d -S $REALM_SCREEN_NAME ./start authserver null "$REALM_CONFIG"
fi
sleep 45
done
start
#!/bin/bash
#GDB_FILE=$2
#CONFIG=$3
#SYSLOG=$4
#SYSERR=$5
#GBD_ENABLED=$6
case $1 in
worldserver)
if [ $6 -eq 1 ]; then
echo "run -c $3" > $2
echo "bt" >> $2
echo "bt full" >> $2
echo "info thread" >> $2
echo "thread apply all backtrace full" >> $2
gdb ./worldserver -x $2 --batch >$4 2>$5
fi
if [ $6 -eq 0 ]; then
./worldserver -c $3
fi
;;
authserver)
./authserver -c $3
;;
esac
After that, configure the restarter-bin file.
Note: If you want to have more realms runing, just uncoment or copy the EXTRAWORLD parts and rename EXTRAWORLD to what variable you want.
chmod +x all those files, put them on the same folder as your worldserver and authserver and run ./restarter
Note before you run the restarter, you have to run one time the worldserver and authserver to create the pid file for each.
The restarter will search for those pid files to detect any crashes.
Note: For every core that you want to add, you have to run it with is own config to create the associated pid. Only this way the restarter will work. /emoticons/default_wink.png
would it be possible instead of having 1 file being overwritten everytime the core crash ( in this case the trace.log file ) to have it add a timestamp to the file?
maybe the core crashes multiple times on various reasons, then you can leave it running for some time without worrying that you miss a crash.
its too bad that the parsing of dump files to that website is not working anymore what was it elegeos.trinitycore.org or something.
i would love to have it working, or if possible even the possibility that people can host it themselfs, but i think that it needs extra scripting on the webserver front.
It will not rewrite the trace file, it will continue it… and separate the trace with a divisor with the date and time.
To create different files i have to look into it and do some testing.
Has for the trace site… i don’t know what it have behind it… If i know what to look, maybe i can create a parser myself. I need more free time to do it. /emoticons/default_wink.png
well the whole parser was on the subdomain of trinity itself as far as i know ( elegeos.trinitycore.org) so the files COULD be in hands of the admin that controls the domain…