Main Contents

L2j, Auto Startup On Server Crash

November 26, 2008

This script is not mine. I stole it somewhere from l2j forums.

You create a file and copy-paste the following text in it:

#!/bin/bash

pid=`ps -C GameServer_loop.sh -o pid=`
pid2=`ps -C java -o pid=`

if [ ! $pid ] ;
then
if [ $pid2 ] ;
then
kill $pid2
fi
echo “Gameserver was restarted “`date` >> /path/to/gameserver/log/restarter.log

cd /path/to/gameserver #PATH TO YOUR SERVER

./startGameServer.sh &
fi

Then by crontab we will execute it every minute:

crontab -e

*/1 * * * * /path/to/cron_rr

The cript will check if gameserver is running and if not will start it.

Filed under: Linux |

Leave a comment

Login