Ejemplo n.º 1
0
	def shutdown(self, relaunch=False):
		self._disconnect(self.servers.keys())
		#stop timers or just not care...
		Timers._stopall()
		reactor.callLater(2.0, self.databasemanager.shutdown) # to give time for individual shutdown
		Dispatcher.unloadModules()
		reactor.callLater(2.5, reactor.stop) # to give time for individual shutdown
		# TODO: make sure this works properly
		# 	it may act odd on Windows due to execv not replacing current process.
		if relaunch:
			register(relaunchfunc, executable, argv)
Ejemplo n.º 2
0
	def initialize(self, logger=None):
		#setup log options
		if not self.console:
			logger.stop()
		if self.logfile:
			log.startLogging(open(join(self.botdir, self.logfile), 'a'), setStdout=False)
		
		# setup global database and databasemanager
		self.databasemanager = DBManager(self.datadir, self.datafile)
		self.reloadStage2()
		#start dbcommittimer
		# TODO: figure out if actually need this, and what SQLite transaction/journaling mode we should be using
		Timers._addTimer("_dbcommit", 60*60, self.databasemanager.dbcommit, reps=-1) #every hour (60*60)
Ejemplo n.º 3
0
	def hardshutdown(self):
		Timers._stopall()
		Dispatcher.unloadModules()
		self.databasemanager.shutdown()
Ejemplo n.º 4
0
 def hardshutdown(self):
     Timers._stopall()
     self.databasemanager.shutdown()