def init(*configFiles): global _svr if _svr: raise RuntimeError, "already initialized" loadConfig(*configFiles) configDefaults() updateConfig() configLogging() # set effective user/group, if necessary isroot=os.getuid()==0 run_user=Configuration.run_user run_group=Configuration.run_group if isroot and run_user is None: raise RuntimeError, "won't run as root with out run_user being defined" if run_group is not None: gid=grp.getnrnam(run_group)[2] if hasattr(os, 'setegid'): os.setegid(gid) #else? if run_user is not None: uid=pwd.getpwnam(run_user)[2] if hasattr(os, 'seteuid'): os.seteuid(uid) #else? loadServices() # revv 'er up _svr=Server(configFiles) _svr.mainloop()
def reload(self): super(Server, self).reload() loadServices() loadConfig(*self.configFiles) configDefaults() updateConfig() configLogging()