#!/bin/sh
### Set your default mangos Root Directory
mangosdir="/opt/mangos/bin"
### Set your mangos Binary Name
mangosbin="startm"
### Set your mangos Pid File
mangospid="mangosd.pid"
########## you probably don't need to change anything below here ##########
cd $mangosdir
# is there a pid file?
if test -r $mangospid
then
# there is a pid file -- is it current?
pid=`cat $mangospid`
if `kill -CHLD $pid >/dev/null 2>&1`
then
echo "mangos-worldd is currently running...."
exit 0
fi
echo ""
echo "Stale $mangospid file, erasing..."
echo "Attempting to Restart mangos-worldd"
rm -f $mangospid
./$mangosbin
else
echo "$mangospid appears to be missing. Attempting to Restart mangos-worldd"
./$mangosbin
fi