X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=blobdiff_plain;f=mudpy;h=431c9a021bbe0baddee4f193c5505fb659e94a91;hp=6b6c1c3e87bc2ae2ed757cd82d2d77f58d402fe6;hb=74d37bfacdd2d7c13192fe2cd5e34f03cc2e399f;hpb=7b8056e7b2eac4fb4e87708afa3de90c3fc02032 diff --git a/mudpy b/mudpy index 6b6c1c3..431c9a0 100755 --- a/mudpy +++ b/mudpy @@ -1,12 +1,33 @@ #!/usr/bin/python """Skeletal executable for the mudpy engine.""" -# Copyright (c) 2005 mudpy, Jeremy Stanley , all rights reserved. +# Copyright (c) 2006 mudpy, Jeremy Stanley , all rights reserved. # Licensed per terms in the LICENSE file distributed with this software. # core objects for the mudpy engine import mudpy -from mudpy import log, on_pulse, reload_data, universe + +# a consistent list so we can reimport these on reload +importlist = [ + "create_pidfile", + "daemonize", + "log", + "on_pulse", + "reload_data", + "remove_pidfile", + "universe" + ] +for item in importlist: exec("from mudpy import " + item) + +# log an initial message +from sys import argv +log("Started mudpy with command line: " + " ".join(argv)) + +# fork and disassociate +daemonize() + +# make the pidfile +create_pidfile(universe) # loop indefinitely while the world is not flagged for termination or # there are connected users @@ -17,6 +38,7 @@ while not universe.terminate_world or universe.userlist: # reload the mudpy module reload(mudpy) + for item in importlist: exec("from mudpy import " + item) # move data into new persistent objects reload_data() @@ -33,3 +55,6 @@ universe.save() # log a final message log("Shutting down now.") +# get rid of the pidfile +remove_pidfile(universe) +