def __init__(self, threads): install(threads) pl = PluginLoader() plugins = pl.load(eager()) agent = Agent(plugins) agent.start(False) while True: sleep(10) print 'Agent: sleeping...'
def start(daemon=True): """ Agent main. Add recurring, time-based actions here. All actions must be subclass of L{action.Action}. """ lock = AgentLock() try: lock.acquire(0) except LockFailed, e: raise Exception('Agent already running') if daemon: daemonize(lock) try: pl = PluginLoader() plugins = pl.load(eager()) agent = Agent(plugins) agent.start() finally: lock.release() def eager(): return int(nvl(cfg.loader.eager, 0)) def usage(): """ Show usage. """ s = [] s.append('\n%sd <options>' % NAME) s.append(' -h, --help')