pidproxy.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:ansible-symphony 作者: istresearch 项目源码 文件源码
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("pidfile", help="pid file location")
    parser.add_argument("command", help="command to run (with args)", nargs=argparse.REMAINDER)
    parser.add_argument("--daemon", "-d", help="handle proxies processes which fork to background and terminate "
                                               "by waiting for a valid pid file, then monitor the pid in order "
                                               "to track the process lifetime", action="store_true")
    parser.add_argument("--start-wait", "-s", help="amount of seconds to wait for a valid pid file to appear "
                                                   "(default: 60, ignored if not using --daemon)",
                        default=60, type=int)
    params = parser.parse_args()
    wait_pidfile_time=None
    if params.daemon:
        wait_pidfile_time = params.start_wait
    pp = PidProxy(pidfile=params.pidfile, cmdargs=params.command, wait_pidfile_time=wait_pidfile_time)
    pp.go()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号