def start(self): '''start Starts the Minecraft server and runs any per-world initialization. ''' # First thing, we need to check to make sure the server isnt running, # we don't want to create any oddness as a result of running two # identically configured servers. if not self.running(): # Next we will run the per-world initialization. Normally this # shouldn't do anything, however if the worlds are stored on # ramdisks then there will be some useful setup stuff happening. self.prsync() # Now just to setup all the variables, determine which java we # will be running, and to build the bash command that we will send # to screen to startup the server. renv = os.path.join(self.env, 'env') java = run('which java') startup = 'cd %s;%s %s -Xms%sm -Xmx%sm -jar %s nogui' % (renv, java, self.java_args, self.min_mem, self.max_mem, self.binary) # And here we go, startup time! screen.new('mc_%s' % self.name, startup, self.logging)
# Append 'self.binary' & 'nogui' to args if 'self.rtoolkit_enabled' # is False; otherwise, test for supported 'self.server_type' # values, and append 'Minecraft_RKit.jar' to the startup string. # For all other 'self.server_type' cases, return False. if not self.rtoolkit_enabled: startup = ' '.join([startup, self.binary]) startup = ' '.join([startup, 'nogui']) elif self.server_type in ['bukkit', 'spigot']: startup = ' '.join([startup, 'Minecraft_RKit.jar']) else: return False # And here we go, startup time! <<<<<<< HEAD screen.new('mc_%s' % self.name, startup) ======= screen.new('mc_%s' % self.name, startup, self.logging) >>>>>>> upstream/master def stop(self): '''stop Tells the minecraft server to stop. ''' # First thing we will need to is tell the server to stop and wait for # the server to finish shutting down. Ensure the '.stopwrapper' # command is used if RemoteToolkit is enabled. if self.rtoolkit_enabled: self.command('.stopwrapper') else: