python类process()的实例源码

daemon.py 文件源码 项目:autosub-bootstrapbill 作者: BenjV 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def run():
    from optparse import OptionParser

    p = OptionParser()
    p.add_option('-c', '--config', action='append', dest='config',
                 help='specify config file(s)')
    p.add_option('-d', action='store_true', dest='daemonize',
                 help='run the server as a daemon')
    p.add_option('-e', '--environment', dest='environment', default=None,
                 help='apply the given config environment')
    p.add_option('-f', action='store_true', dest='fastcgi',
                 help='start a fastcgi server instead of the default HTTP '
                      'server')
    p.add_option('-s', action='store_true', dest='scgi',
                 help='start a scgi server instead of the default HTTP server')
    p.add_option('-x', action='store_true', dest='cgi',
                 help='start a cgi server instead of the default HTTP server')
    p.add_option('-i', '--import', action='append', dest='imports',
                 help='specify modules to import')
    p.add_option('-p', '--pidfile', dest='pidfile', default=None,
                 help='store the process id in the given file')
    p.add_option('-P', '--Path', action='append', dest='Path',
                 help='add the given paths to sys.path')
    options, args = p.parse_args()

    if options.Path:
        for p in options.Path:
            sys.path.insert(0, p)

    start(options.config, options.daemonize,
          options.environment, options.fastcgi, options.scgi,
          options.pidfile, options.imports, options.cgi)
daemon.py 文件源码 项目:watcher 作者: nosmokingbandit 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def run():
    from optparse import OptionParser

    p = OptionParser()
    p.add_option('-c', '--config', action="append", dest='config',
                 help="specify config file(s)")
    p.add_option('-d', action="store_true", dest='daemonize',
                 help="run the server as a daemon")
    p.add_option('-e', '--environment', dest='environment', default=None,
                 help="apply the given config environment")
    p.add_option('-f', action="store_true", dest='fastcgi',
                 help="start a fastcgi server instead of the default HTTP "
                      "server")
    p.add_option('-s', action="store_true", dest='scgi',
                 help="start a scgi server instead of the default HTTP server")
    p.add_option('-x', action="store_true", dest='cgi',
                 help="start a cgi server instead of the default HTTP server")
    p.add_option('-i', '--import', action="append", dest='imports',
                 help="specify modules to import")
    p.add_option('-p', '--pidfile', dest='pidfile', default=None,
                 help="store the process id in the given file")
    p.add_option('-P', '--Path', action="append", dest='Path',
                 help="add the given paths to sys.path")
    options, args = p.parse_args()

    if options.Path:
        for p in options.Path:
            sys.path.insert(0, p)

    start(options.config, options.daemonize,
          options.environment, options.fastcgi, options.scgi,
          options.pidfile, options.imports, options.cgi)


问题


面经


文章

微信
公众号

扫码关注公众号