예제 #1
0
def _run_server():
    import cleanup
    import motionctl
    import thumbnailer
    import tornado.ioloop
    import server

    server.application.listen(settings.PORT, settings.LISTEN)
    logging.info("server started")

    tornado.ioloop.IOLoop.instance().start()

    logging.info("server stopped")

    if thumbnailer.running():
        thumbnailer.stop()
        logging.info("thumbnailer stopped")

    if cleanup.running():
        cleanup.stop()
        logging.info("cleanup stopped")

    if motionctl.running():
        motionctl.stop()
        logging.info("motion stopped")

    if settings.SMB_SHARES:
        smbctl.umount_all()
        logging.info("SMB shares unmounted")
예제 #2
0
def run():
    import cleanup
    import motionctl
    import motioneye
    import smbctl
    import thumbnailer
    import tornado.ioloop

    configure_signals()
    logging.info('hello! this is motionEye server %s' % motioneye.VERSION)

    test_requirements()

    if settings.SMB_SHARES:

        stop, start = smbctl.update_mounts()  # @UnusedVariable
        if start:
            start_motion()

    else:
        start_motion()

    start_cleanup()
    start_wsswitch()

    if settings.THUMBNAILER_INTERVAL:
        start_thumbnailer()

    template.add_context('static_path', settings.BASE_PATH + '/static/')
    
    application = Application(handler_mapping, debug=False, log_function=_log_request,
            static_path=settings.STATIC_PATH, static_url_prefix='/static/')
    
    application.listen(settings.PORT, settings.LISTEN)
    logging.info('server started')
    
    tornado.ioloop.IOLoop.instance().start()

    logging.info('server stopped')
    
    if thumbnailer.running():
        thumbnailer.stop()
        logging.info('thumbnailer stopped')

    if cleanup.running():
        cleanup.stop()
        logging.info('cleanup stopped')

    if motionctl.running():
        motionctl.stop()
        logging.info('motion stopped')
    
    if settings.SMB_SHARES:
        smbctl.umount_all()
        logging.info('SMB shares unmounted')

    logging.info('bye!')
예제 #3
0
def run():
    import cleanup
    import motionctl
    import motioneye
    import smbctl
    import thumbnailer
    import tornado.ioloop

    configure_signals()
    logging.info('hello! this is motionEye server %s' % motioneye.VERSION)

    test_requirements()

    if settings.SMB_SHARES:

        stop, start = smbctl.update_mounts()  # @UnusedVariable
        if start:
            start_motion()

    else:
        start_motion()

    start_cleanup()
    start_wsswitch()

    if settings.THUMBNAILER_INTERVAL:
        start_thumbnailer()

    application.listen(settings.PORT, settings.LISTEN)
    logging.info('server started')
    
    tornado.ioloop.IOLoop.instance().start()

    logging.info('server stopped')
    
    if thumbnailer.running():
        thumbnailer.stop()
        logging.info('thumbnailer stopped')

    if cleanup.running():
        cleanup.stop()
        logging.info('cleanup stopped')

    if motionctl.running():
        motionctl.stop()
        logging.info('motion stopped')
    
    if settings.SMB_SHARES:
        smbctl.umount_all()
        logging.info('SMB shares unmounted')

    logging.info('bye!')
예제 #4
0
파일: server.py 프로젝트: Squal78/motioneye
def run():
    import cleanup
    import motionctl
    import motioneye
    import smbctl
    import thumbnailer
    import tornado.ioloop

    configure_signals()
    logging.info('hello! this is motionEye server %s' % motioneye.VERSION)

    test_requirements()

    if settings.SMB_SHARES:

        stop, start = smbctl.update_mounts()  # @UnusedVariable
        if start:
            start_motion()

    else:
        start_motion()

    start_cleanup()
    start_wsswitch()

    if settings.THUMBNAILER_INTERVAL:
        start_thumbnailer()

    application.listen(settings.PORT, settings.LISTEN)
    logging.info('server started')
    
    tornado.ioloop.IOLoop.instance().start()

    logging.info('server stopped')
    
    if thumbnailer.running():
        thumbnailer.stop()
        logging.info('thumbnailer stopped')

    if cleanup.running():
        cleanup.stop()
        logging.info('cleanup stopped')

    if motionctl.running():
        motionctl.stop()
        logging.info('motion stopped')
    
    if settings.SMB_SHARES:
        smbctl.umount_all()
        logging.info('SMB shares unmounted')

    logging.info('bye!')
예제 #5
0
def _run_process():
    global _process
    
    ioloop = tornado.ioloop.IOLoop.instance()
    
    if thumbnailer.running():
        # postpone if thumbnailer is currently running
        ioloop.add_timeout(datetime.timedelta(seconds=60), _run_process)
        
        return
        
    else:
        # schedule the next call
        ioloop.add_timeout(datetime.timedelta(seconds=settings.CLEANUP_INTERVAL), _run_process)

    if not running(): # check that the previous process has finished
        logging.debug('running cleanup process...')

        _process = multiprocessing.Process(target=_do_cleanup)
        _process.start()
예제 #6
0
def _run_process():
    global _process
    
    ioloop = tornado.ioloop.IOLoop.instance()
    
    if thumbnailer.running():
        # postpone if thumbnailer is currently running
        ioloop.add_timeout(datetime.timedelta(seconds=60), _run_process)
        
        return
        
    else:
        # schedule the next call
        ioloop.add_timeout(datetime.timedelta(seconds=settings.CLEANUP_INTERVAL), _run_process)

    if not running(): # check that the previous process has finished
        logging.debug('running cleanup process...')

        _process = multiprocessing.Process(target=_do_cleanup)
        _process.start()
예제 #7
0
def run():
    import cleanup
    import mjpgclient
    import motionctl
    import motioneye
    import smbctl
    import thumbnailer
    import wsswitch

    configure_signals()
    logging.info('hello! this is motionEye server %s' % motioneye.VERSION)

    test_requirements()

    if settings.SMB_SHARES:
        stop, start = smbctl.update_mounts()  # @UnusedVariable
        if start:
            start_motion()

    else:
        start_motion()

    if settings.CLEANUP_INTERVAL:
        cleanup.start()
        logging.info('cleanup started')
        
    wsswitch.start()
    logging.info('wsswitch started')

    if settings.THUMBNAILER_INTERVAL:
        thumbnailer.start()
        logging.info('thumbnailer started')

    if settings.MJPG_CLIENT_TIMEOUT:
        mjpgclient.start()
        logging.info('mjpg client garbage collector started')

    if settings.SMB_SHARES:
        smbctl.start()
        logging.info('smb mounts started')

    template.add_context('static_path', settings.BASE_PATH + '/static/')
    
    application = Application(handler_mapping, debug=False, log_function=_log_request,
            static_path=settings.STATIC_PATH, static_url_prefix='/static/')
    
    application.listen(settings.PORT, settings.LISTEN)
    logging.info('server started')
    
    IOLoop.instance().start()

    logging.info('server stopped')
    
    if thumbnailer.running():
        thumbnailer.stop()
        logging.info('thumbnailer stopped')

    if cleanup.running():
        cleanup.stop()
        logging.info('cleanup stopped')

    if motionctl.running():
        motionctl.stop()
        logging.info('motion stopped')
    
    if settings.SMB_SHARES:
        smbctl.stop()
        logging.info('smb mounts stopped')

    logging.info('bye!')
예제 #8
0
def run():
    import cleanup
    import motionctl
    import motioneye
    import smbctl
    import thumbnailer
    import tornado.ioloop

    configure_signals()
    logging.info("hello! this is motionEye server %s" % motioneye.VERSION)

    test_requirements()

    if settings.SMB_SHARES:

        stop, start = smbctl.update_mounts()  # @UnusedVariable
        if start:
            start_motion()

    else:
        start_motion()

    start_cleanup()
    start_wsswitch()

    if settings.THUMBNAILER_INTERVAL:
        start_thumbnailer()

    template.add_context("static_path", settings.BASE_PATH + "/static/")

    application = Application(
        handler_mapping,
        debug=False,
        log_function=_log_request,
        static_path=settings.STATIC_PATH,
        static_url_prefix="/static/",
    )

    application.listen(settings.PORT, settings.LISTEN)
    logging.info("server started")

    tornado.ioloop.IOLoop.instance().start()

    logging.info("server stopped")

    if thumbnailer.running():
        thumbnailer.stop()
        logging.info("thumbnailer stopped")

    if cleanup.running():
        cleanup.stop()
        logging.info("cleanup stopped")

    if motionctl.running():
        motionctl.stop()
        logging.info("motion stopped")

    if settings.SMB_SHARES:
        smbctl.umount_all()
        logging.info("SMB shares unmounted")

    logging.info("bye!")