#!/bin/sh ### Set your default mangos Root Directory mangosdir="/home/tatara/wow/bin" ### Set your mangos options i.e. conf location etc mangosconf="-c /home/tatara/wow/etc/mangosd.conf" ### Set your mangos Binary Name mangosbin="mangos-worldd" ### Set your screen name here mangossname="mangosd" ### Set your mangos Pid File mangospid="mangosd.pid" ########## you probably don't need to change anything below here ########## ### PID Writer dont change unless you know what you are doing mangospidrite="ps -e | awk '/$mangosbin/ && !/awk/ {print $1}' > $mangosdir/$mangospid" 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 "$mangosbin is currently running...." exit 0 fi echo "" echo "Stale $mangospid file, erasing..." echo "Attempting to Restart mangosd" rm -f $mangospid screen -A -m -d -S $mangossname ./$mangosbin $mangosconf $mangospidrite else echo "$mangospid appears to be missing. Attempting to Restart mangosd" screen -A -m -d -S $mangossname ./$mangosbin $mangosconf $mangospidrite fi