/
MudOS_0.9.19/bin/
MudOS_0.9.19/doc/concepts/
MudOS_0.9.19/doc/driver/
MudOS_0.9.19/doc/efuns/bitstrings/
MudOS_0.9.19/doc/efuns/buffers/
MudOS_0.9.19/doc/efuns/communication/
MudOS_0.9.19/doc/efuns/core/
MudOS_0.9.19/doc/efuns/mappings/
MudOS_0.9.19/doc/efuns/math/
MudOS_0.9.19/doc/efuns/security/
MudOS_0.9.19/doc/lpc/constructs/
MudOS_0.9.19/doc/lpc/types/
MudOS_0.9.19/doc/platforms/
MudOS_0.9.19/etc/
MudOS_0.9.19/mudlib/
MudOS_0.9.19/mudlib/lil/
MudOS_0.9.19/mudlib/lil/clone/
MudOS_0.9.19/mudlib/lil/command/
MudOS_0.9.19/mudlib/lil/data/
MudOS_0.9.19/mudlib/lil/etc/
MudOS_0.9.19/mudlib/lil/include/
MudOS_0.9.19/mudlib/lil/inherit/
MudOS_0.9.19/mudlib/lil/inherit/master/
MudOS_0.9.19/mudlib/lil/log/
MudOS_0.9.19/mudlib/lil/single/
MudOS_0.9.19/mudlib/lil/u/
MudOS_0.9.19/src/testsuite/
MudOS_0.9.19/src/testsuite/clone/
MudOS_0.9.19/src/testsuite/command/
MudOS_0.9.19/src/testsuite/data/
MudOS_0.9.19/src/testsuite/etc/
MudOS_0.9.19/src/testsuite/include/
MudOS_0.9.19/src/testsuite/inherit/
MudOS_0.9.19/src/testsuite/inherit/master/
MudOS_0.9.19/src/testsuite/log/
MudOS_0.9.19/src/testsuite/single/
MudOS_0.9.19/src/testsuite/single/efuns/
MudOS_0.9.19/src/testsuite/u/
#!/bin/sh
#
# file:    startmud (linked to stopmud)
# version: 0.93
# date:    1993 January 09
# desc:    Bourne shell script for starting the MudOS driver and related
#          binaries. (replaces restart_mud)
#	   Fixed by Zak to use basename in recognizing name as stopmud
#

# directory for MudOS-related binaries (driver, addr_server, ftpd, etc)
BINDIR=/MudOS_0.9/bin

# don't change anything below this line unless you know what you are doing.

if test $# -ne 1
then
	echo "usage: $0 mud_name"
	exit 1
fi

# source the info on the mud
if test -f ${BINDIR}/$1.info
then
	. $1.info
else
	echo "$0: Unable to find info file '$1.info'"
	exit 2
fi


if test "`basename $0`" = "stopmud"
then
	PID=`cat ${BINDIR}/${PIDFILE}`
	echo "killing ${PID}"
	kill ${PID}
	exit 0
fi

if test -d ${BINDIR}
then
	true
else
	echo "$0: couldn't find binaries directory: ${BINDIR}"
	exit 3
fi

echo $$ > ${BINDIR}/${PIDFILE}

#if test -f ${BINDIR}/${FTPD}
#then
#	${BINDIR}/${FTPD} -l
#else
#	echo "$0: Unable to find the ftp daemon:\n\t${BINDIR}/${FTPD}."
#	echo "Continuing anyway."
#fi

if test -f ${BINDIR}/${ASERVER}
then
	${BINDIR}/${ASERVER} ${APORT} >> ${LOGDIR}/${ALOG} 2> ${LOGDIR}/${AERR} &
else
	echo "$0: Unable to find the address server:\n\t${BINDIR}/${ASERVER}."
	echo "Continuing anyway."
fi

if test -f ${BINDIR}/${DRIVER}
then
	while true
	do
		echo -n "Driver came up: " >> ${LOGDIR}/${UP}
		date >> ${LOGDIR}/${UP}
		${BINDIR}/${DRIVER} ${CONFIG} > ${LOGDIR}/${LOG} 2> ${LOGDIR}/${ERR}
		ERROR=$?
		echo -n "Driver went down (exit code: ${ERROR}): " >> ${LOGDIR}/${UP}
		date >> ${LOGDIR}/${UP}
		rm -f ${LOGDIR}/${LOG}.old
		mv ${LOGDIR}/${LOG} ${LOGDIR}/${LOG}.old
		rm -f ${LOGDIR}/${ERR}.old
		mv ${LOGDIR}/${ERR} ${LOGDIR}/${ERR}.old
		if test $ERROR -eq 255
		then
			echo "Driver exited with -1.  Halting." >> ${LOGDIR}/${UP}
			echo "Halting"
			exit 255
		fi
	done
else
	echo "$0: Unable to find the gamedriver executable:\n\t${BINDIR}/${DRIVER}"
	echo "Halting."
fi