Use here is such a restarter
Code:
#!/bin/sh
while true ; do
servlog='/home/fun/sarglua/logs/Server.log';
outpatch='/home/fun/sarglua/logs/crash/';
date=`date "+%Y-%m-%d_%H:%M:%S"`;
echo "Server CRASHED !!! Start Bugreport System." >> $outpatch$date.txt;
echo "Server.log Log FILE Last 30 Lines:" >> $outpatch$date.txt;
cat $servlog | tail -n 30 >> $outpatch$date.txt;
echo "" >> $outpatch$date.txt;
echo "END bugtracker system." >> $outpatch$date.txt;
/home/fun/sarglua/bin/worldserver -c /home/fun/sarglua/bin/worldserver.conf
done;
I know it's off topic, but your restart script is annoying, it already knows where to add to the crash log..
Should also run a screen with it...
Do:
Code:
touch /home/fun/sarglua/bin/world.sh && touch /home/fun/sarglua/bin/wcheck.sh
Paste this into world.sh:
Code:
SESSION="worldserver"
DAEMON="screen -d -m -S $SESSION /home/fun/sarglua/bin/wcheck.sh"
screen -r $SESSION -ls -q 2>&1 >/dev/null
echo -e ""
echo "World has been launched into the background."
echo -e ""
if [ $? -le 10 ]; then
echo "Restarting $DAEMON"
$DAEMON
fi
wait
Paste this into wcheck.sh:
Code:
while true; do
cd /home/fun/sarglua/bin/
./worldserver
wait
done
Then:
Code:
chmod +x /home/fun/sarglua/bin/world.sh && chmod +x /home/fun/sarglua/bin/wcheck.sh
and just run your server with ./world.sh
Don't need the extra stuff you got on yours.. and you can do the same for auth, then
just screen -x back into the screen's PTR to control.. ctrl a+d to detach from screen.
Also in the end, you should never, ever run servers like this as root. It should all be under a user.