Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 管理Supervisord流程-启动时自动启动/it崩溃时自动启动_Linux_Unix_Ansible_Supervisord - Fatal编程技术网

Linux 管理Supervisord流程-启动时自动启动/it崩溃时自动启动

Linux 管理Supervisord流程-启动时自动启动/it崩溃时自动启动,linux,unix,ansible,supervisord,Linux,Unix,Ansible,Supervisord,我们正在使用Supervisord进行apache服务器进程监视 因此,我希望在以下两种情况下始终保持主管流程正常: 服务器重新启动时自动启动管理器(无init.d帮助) Autostart supervisor进程在运行时崩溃 我们还安装了ansible 如果有人能分享他们对ansible的想法,那就太好了。我将从ansible开始-您可以使用它来安装supervisor(例如,apt模块,如果您必须使用它): 并部署必要的管理器配置文件(使用) 要自动启动管理器本身,只需启用它(可以使用-e

我们正在使用Supervisord进行apache服务器进程监视

因此,我希望在以下两种情况下始终保持主管流程正常:

  • 服务器重新启动时自动启动管理器(无init.d帮助)
  • Autostart supervisor进程在运行时崩溃
  • 我们还安装了ansible


    如果有人能分享他们对ansible的想法,那就太好了。

    我将从ansible开始-您可以使用它来安装supervisor(例如,apt模块,如果您必须使用它):

    并部署必要的管理器配置文件(使用)

    要自动启动管理器本身,只需启用它(可以使用-enabled:yes)。要使主管控制的程序自动启动和自动重新启动,请在程序配置文件中设置正确的指令。例如:

    [program:apache]
    command=apache2ctl -c "ErrorLog /dev/stdout" -DFOREGROUND
    # this would autostart apache
    autostart=true
    # this would autorestart it if it crashes
    autorestart=true
    startretries=1
    startsecs=1
    redirect_stderr=true
    stderr_logfile=/var/log/myapache.err.log
    stdout_logfile=/var/log/myapache.out.log
    user=root
    killasgroup=true
    stopasgroup=true
    

    您好,谢谢您的建议,我试图使用“服务”模块,并得到以下错误。失败!=>{“changed”:false,“failed”:true,“msg”:“中的标准必须是tty\n”}有什么建议吗?我和主管的处理程序有类似的问题。它无法重新启动。尝试使用服务模块的
    sleep
    选项(如果您有systemd,它将不起作用),或者简单地使用
    shell
    模块和a
    shell:service supervisor restart
    。您好@13nilux,再次收到您的来信并为这个问题花费宝贵的时间,真是太好了。除了上面讨论的模块外,v是否可以使用“Anisible crontab”模块在启动时为autostart supervisor在crontab中创建一个条目??如果有,你能分享一些例子吗?如果你启用它,主管将在开机时启动。使用服务模块执行此操作(不是重新启动/启动/停止-如上所述,而是仅启用它)如下:
    service:name=supervisor enabled=yes
    ok,太好了。。所以,顺便说一句,这将是一个条目。。我的意思是在服务器重新启动时在哪个文件(linux)中启动supervisor
    - name: Deploy config file
      copy: src=yourconfigfile.conf dest=/etc/supervisor/conf.d/apache.conf mode=644
      become: yes
    
    [program:apache]
    command=apache2ctl -c "ErrorLog /dev/stdout" -DFOREGROUND
    # this would autostart apache
    autostart=true
    # this would autorestart it if it crashes
    autorestart=true
    startretries=1
    startsecs=1
    redirect_stderr=true
    stderr_logfile=/var/log/myapache.err.log
    stdout_logfile=/var/log/myapache.out.log
    user=root
    killasgroup=true
    stopasgroup=true