# You may comment out any of these, or add more of your own.  The only
# requirement for a 'status-reporting' object is that it have a method
# 'status' that will return a producer, which will generate an HTML
# description of the status of the object.

status_objects = [
        hs,
        ftp,
        ms,
        cs,
        rs,
        lg
        ]

# Create a status handler.  By default it binds to the URI '/status'...
sh = status_handler.status_extension(status_objects)
# ... and install it on the web server.
hs.install_handler (sh)

# become 'nobody'
try:
    if os.name == 'posix':
        if hasattr (os, 'seteuid'):
            import pwd
            [uid, gid] = pwd.getpwnam ('nobody')[2:4]
            os.setegid (gid)
            os.seteuid (uid)
except Exception:
    pass

# Finally, start up the server loop!  This loop will not exit until
Exemple #2
0
        import supervisor.medusa.ftp_server as ftp_server
        import supervisor.medusa.chat_server as chat_server
        import supervisor.medusa.resolver as resolver
        import supervisor.medusa.logger as logger
        rs = resolver.caching_resolver ('127.0.0.1')
        lg = logger.file_logger (sys.stdout)
        ms = monitor.secure_monitor_server ('fnord', '127.0.0.1', 9999)
        fs = filesys.os_filesystem (sys.argv[1])
        dh = default_handler.default_handler (fs)
        hs = http_server ('', int(sys.argv[2]), rs, lg)
        hs.install_handler (dh)
        ftp = ftp_server.ftp_server (
                ftp_server.dummy_authorizer(sys.argv[1]),
                port=8021,
                resolver=rs,
                logger_object=lg
                )
        cs = chat_server.chat_server ('', 7777)
        sh = status_handler.status_extension([hs,ms,ftp,cs,rs])
        hs.install_handler (sh)
        if '-p' in sys.argv:
            def profile_loop ():
                try:
                    asyncore.loop()
                except KeyboardInterrupt:
                    pass
            import profile
            profile.run ('profile_loop()', 'profile.out')
        else:
            asyncore.loop()
cs = chat_server.chat_server(IP_ADDRESS, CHAT_PORT)

# ===========================================================================
# Status Handler
# ===========================================================================

# These are objects that can report their status via the HTTP server.
# You may comment out any of these, or add more of your own.  The only
# requirement for a 'status-reporting' object is that it have a method
# 'status' that will return a producer, which will generate an HTML
# description of the status of the object.

status_objects = [hs, ftp, ms, cs, rs, lg]

# Create a status handler.  By default it binds to the URI '/status'...
sh = status_handler.status_extension(status_objects)
# ... and install it on the web server.
hs.install_handler(sh)

# become 'nobody'
try:
    if os.name == 'posix':
        if hasattr(os, 'seteuid'):
            import pwd
            [uid, gid] = pwd.getpwnam('nobody')[2:4]
            os.setegid(gid)
            os.seteuid(uid)
except Exception:
    pass

# Finally, start up the server loop!  This loop will not exit until
Exemple #4
0
        import supervisor.medusa.status_handler as status_handler
        import supervisor.medusa.ftp_server as ftp_server
        import supervisor.medusa.chat_server as chat_server
        import supervisor.medusa.resolver as resolver
        rs = resolver.caching_resolver('127.0.0.1')
        lg = logger.file_logger(sys.stdout)
        ms = monitor.secure_monitor_server('fnord', '127.0.0.1', 9999)
        fs = filesys.os_filesystem(sys.argv[1])
        dh = default_handler.default_handler(fs)
        hs = http_server('', int(sys.argv[2]), rs, lg)
        hs.install_handler(dh)
        ftp = ftp_server.ftp_server(ftp_server.dummy_authorizer(sys.argv[1]),
                                    port=8021,
                                    resolver=rs,
                                    logger_object=lg)
        cs = chat_server.chat_server('', 7777)
        sh = status_handler.status_extension([hs, ms, ftp, cs, rs])
        hs.install_handler(sh)
        if '-p' in sys.argv:

            def profile_loop():
                try:
                    asyncore.loop()
                except KeyboardInterrupt:
                    pass

            import profile
            profile.run('profile_loop()', 'profile.out')
        else:
            asyncore.loop()