Is there Windows analog to supervisord?

前端 未结 6 1609
情书的邮戳
情书的邮戳 2020-12-01 01:08

I need to run python script and be sure that it will restart after it terminates. I know that there is UNIX solution called supervisord. But unfortunately server where my sc

6条回答
  •  误落风尘
    2020-12-01 01:28

    No, supervisord is not supported under Windows.

    BUT what you can do is, to restart it automatically from a wrapper script:

    #!/usr/bin/python
    from subprocess import Popen
    
    file_path = " script_to_be_restarted.py"
    args_as_str = " --arg1=woop --arg2=woop"
    
    while True:
        print("(Re-)Start script %s %s" % (file_path, args_as_str))
        p = Popen("python " + file_path + args_as_str, shell=True)
        p.wait()
    

提交回复
热议问题