PDA

View Full Version : zone-world on cron?


wize_one
05-17-2004, 08:10 PM
i could swear i read somewhere about world and zone being cron'd.. but search not finding it..

is there a way to set world and zones on cron so if they happen to die cron will restart them?

smogo
05-18-2004, 12:04 AM
write a script that checks for processes being dead or gone, then relaunches it. Cron that script.

Just an example for non parameterized script relaunching 7997, should be something like

if ! ps ax | grep "zone . myip 7997 myip" |grep -v "grep" 1> /dev/null 2> /dev/null ; then
echo "Zone on port 7997 is dead, restarting ..."
startzone7997.sh
fi



then add to your crontab :
*/3 * * * * relaunchscript.sh 2>&1 >> ~/restart.log
to test every 3 mins.

Pb is deciding what to restart, if world is down, or one or more zones. Restart, one, all, ... ? Up to you ;). This is just an idea, i'd be interested in some public script if you set up one.

Doodman
05-18-2004, 03:37 AM
Either that, or start them from init by setting up lines in your inittab:

(This is just a types in example, btw, your milage may vary)
# World
w1:b:respawn:/usr/local/bin/startworld
# Zones
z1:c:respawn:/usr/local/bin/startzone . 1.1.1.1 7001 1.1.1.1
z2:c:respawn:/usr/local/bin/startzone . 1.1.1.1 7002 1.1.1.1
z3:c:respawn:/usr/local/bin/startzone . 1.1.1.1 7003 1.1.1.1
z4:c:respawn:/usr/local/bin/startzone . 1.1.1.1 7004 1.1.1.1


startworld:
#!/bin/bash
cd /path/to/eqemu
export LD_LIBRARY_PATH=.
./world

startzone:#!/bin/bash
cd /path/to/eqemu
export LD_LIBRARY_PATH=.
./zone $*

To start world:
/sbin/telinit b

To start zones:
/sbin/telinit c

Again, just typed in, but you get the idea.