def main(): try: global agent_lastrun agent_lastrun = time() broker = Server(server_uri) server_version = broker.bap_version() if server_version == agent_version: #TODO: check for files modified since our last run... while 1: # recursively crawl folders in our list and find files with the archive bit set. agent_thisrunstarted = time() for root, dirs, files in walk(agent_rootdir): for filename in files: #TODO: any OS specific things will have to be done here? fullname = join(root, filename) modtime = stat(fullname).st_mtime if agent_lastrun < modtime: #TODO: this is a file-update, handle it accordingly print agent_lastrun, modtime, fullname sleep(agent_timebetweenchecks) agent_lastrun = agent_thisrunstarted #TODO: we need a clever way of handling deletes and/or renames!!! else: #TODO: handle agent/version mismatch by prompting agent to upgrade. print "oops! version mismatch!" except KeyboardInterrupt: #TODO: call signal_handle_sigterm() exit(1)