def start(): context = pyudev.Context() monitor = pyudev.Monitor.from_netlink(context) monitor.filter_by(subsystem='usb') monitor.start() for device in iter(monitor.poll, None): time.sleep(4) start()
def main(): if bootstrap.start() is False: sys.exit(1) # web urls_val = urls.load() print urls_val app = web.application(urls_val, globals(), autoreload=True) app.internalerror = web.debugerror sys.argv = [sys.argv[0], akiyoshi.config.listen] # argv setup!! # load processor!! app.add_processor(processor.load_database) # load plugin plugin.load() # start try: akiyoshi.log.info("akiyoshi web server start.") app.run() except Exception, e: akiyoshi.log.critical(traceback.format_exc()) print >>sys.stderr, "[ERROR] %s" % str(e.args) print >>sys.stderr, traceback.format_exc() return 1
def main(): if bootstrap.start() is False: sys.exit(1) # start try: try: metadata = db.get_metadata() metadata.drop_all() metadata.create_all() return 0 except sqlalchemy.exceptions.IntegrityError, e: print >>sys.stderr, "[ERROR] %s" % str(e) return 1 except Exception, e: akiyoshi.log.critical(traceback.format_exc()) print >>sys.stderr, "[ERROR] %s" % str(e.args) print >>sys.stderr, traceback.format_exc() return 1
def main(): if bootstrap.start() is False: sys.exit(1) # start try: session = db.get_session() user = userService.merge(session, akiyoshi.config["admin"]["user"], akiyoshi.config["admin"]["password"], "Administrator") try: session.commit() return 0 except sqlalchemy.exceptions.IntegrityError, e: print >>sys.stderr, "[ERROR] %s" % str(e) return 1 except Exception, e: akiyoshi.log.critical(traceback.format_exc()) print >>sys.stderr, "[ERROR] %s" % str(e.args) print >>sys.stderr, traceback.format_exc() return 1
from bootstrap import start # Starting the application start()