def main(daemonType, fork=True): conf = config.data(daemonType) conf['id'] = resolveDaemonId(conf['id']) if not conf: raise Exception('No section "daemon_%s" in config' % id) for k in conf: if k[0:4] == 'env_': log.info('Set ENV.%s = %s' % (k[4:],conf[k])) os.environ[k[4:]] = conf[k] d = Daemon(daemonType, conf['id'], getDaemonMainFunction(daemonType)) if fork: d.fork() else: d.main()
def getCommandDirs(): dirs = [] # If user has configured custom commands dir items = config.data('commandline') if items: for key in items: tmp = key.split('.') if len(tmp) == 2 and tmp[0] == 'commands': dirs.append( items[key] + '/commands' ) # Build in commands dirs.append( config.get('libdir') + '/commandline/commands' ) return dirs