def __init__(self, configfile=None, dprg="empd.py"): """Load the configuration files, create the CommRouter, and then create the daemon. """ # get yourself a timer! self.start_time=time.time() self.fm_start_time = time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime(self.start_time)) # presets! self.registry = None #Registry object!! self.aman = None #AttachmentManager self.router = None #message router # now set up the internal configuration via a config file. self.config=EmpConfigParser(configfile) self.config.validateInternals() setup_logging(self.config) # adjust by the configurations.... RDaemon.__init__(self, self.config.get("Daemon", "pid-file"), pchannel=self.config.getint("Daemon", "port"), dprog=dprg, dargs=configfile)
def startup(self): """ Startup the daemon if there is a variable called boot-launch and it's True. """ if self.config.getboolean("Daemon", "boot-launch"): RDaemon.start(self)
def stop(self): """ Stops the daemon but then waits a while to make sure all the threads are done. """ try: RDaemon.stop(self) time.sleep(3)#dont worry about the magic number except: pass