nakedmudv3.0/
nakedmudv3.0/lib/
nakedmudv3.0/lib/logs/
nakedmudv3.0/lib/misc/
nakedmudv3.0/lib/players/
nakedmudv3.0/lib/pymodules/
nakedmudv3.0/lib/txt/
nakedmudv3.0/lib/world/
nakedmudv3.0/lib/world/examples/
nakedmudv3.0/lib/world/examples/mproto/
nakedmudv3.0/lib/world/examples/oproto/
nakedmudv3.0/lib/world/examples/reset/
nakedmudv3.0/lib/world/examples/rproto/
nakedmudv3.0/lib/world/examples/trigger/
nakedmudv3.0/lib/world/limbo/
nakedmudv3.0/lib/world/limbo/rproto/
nakedmudv3.0/src/alias/
nakedmudv3.0/src/char_vars/
nakedmudv3.0/src/editor/
nakedmudv3.0/src/example_module/
nakedmudv3.0/src/help/
nakedmudv3.0/src/set_val/
nakedmudv3.0/src/socials/
nakedmudv3.0/src/time/
#!/usr/bin/python
################################################################################
#
# autorun.py
#
# This autorun script was designed to be used with NakedMud. It will 
# automagically restart your MUD any time it crashes. If the MUD is manually
# shut down, the autorun script will terminate. 
#
# Geoff Hollis
# http://www.ualberta.ca/~hollis/nakedmud.html
#
################################################################################

from time import sleep   # we delay before restarting
from os   import system  # to start running the MUD

# how long do we delay before a restart (seconds)
restart_delay = 5

# the path to the MUD binary
path = './NakedMud'

# the port we will be running the MUD under
port = 4000

# the command we execute to boot up the MUD
cmd  = "%s %d" % (path, port)

# now, while we have not exited without an error, run the MUD 
# and reboot it every time we exit with an error (we crash)
while True:
    # run the MUD
    status = system(cmd)

    # exited normally
    if status == 0:
	break;
    else:
	# We should probably see if we can figure out what kind of
	# error caused the crash here, and report it

	# wait out our delay, then restart the MUD
	sleep(restart_delay)