zoukankan      html  css  js  c++  java
  • Ubuntu 下使 supervisord 随系统启动 (sysV init.d) --- Obsoleted

     Use  systemd is a better choice    https://www.cnblogs.com/gaowengang/p/14654746.html

    ===================================================================================================================  Obsoleted 

    https://github.com/Supervisor/initscripts 下载 initscript,注意根据当前机器 supervisor 的安装情况和 supervisor.conf 的配置情况调整 ubuntu initscript。

    例如,我的 supervisord 和 supervisorctrl 分别为,

    $ which supervisord 
    /usr/local/bin/supervisord
    $ which supervisorctl 
    /usr/local/bin/supervisorctl

    则调整 initscript 如下,

    ...
    . /lib/lsb/init-functions PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/bin/supervisord SUPERVISORCTL=/usr/local/bin/supervisorctl NAME=supervisord DESC=supervisor test -x $DAEMON || exit 0
    ...

    我的 supervisord.conf 在 /etc 目录下,并且其中配置的 logfile 和 pid 都在 /tmp 下 (因为有些系统会周期性的删除 /tmp 下的旧文件,所以不建议将 logfile 和 pid 文件存在此目录下),所以调整 initscript 如下,

    ...
    test -x $DAEMON || exit 0
    LOGDIR=/var/log
    PIDFILE=/var/run/$NAME.pid
    DODTIME
    =5 # Time to wait for the server to die, in seconds # If this value is set too low you might not # let some servers to die gracefully and # 'restart' will not work # Include supervisor defaults if available if [ -f /etc/default/supervisor ] ; then . /etc/default/supervisor fi DAEMON_OPTS="-c /etc/supervisord.conf $DAEMON_OPTS" set -e running_pid()
    ...

    调整 /etc/supervisord.conf

    ...
    [unix_http_server]
    file=/var/run/supervisor.sock   ; the path to the socket file
    chmod=0777; ; socket file mode (default 0700)
    ... [supervisord] logfile=/var/log/supervisord.log ; main log file; default $CWD/supervisord.log ... pidfile=/var/run/supervisord.pid ; supervisord pidfile; default supervisord.pid ... [supervisorctl] serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket ...

    然后将调整后的 initscript 文件拷贝到 /etc/init.d 目录下,并重命名为 supervisord

    $ sudo cp ubuntu /etc/init.d/supervisord

    然后,为其增加可执行权限,

    $ sudo chmod a+x /etc/init.d/supervisord

     然后,schedule it,

    $ sudo update-rc.d supervisord defaults

    然后,重新启动服务,

    $ sudo service supervisord stop
    $ sudo service supervisord start

    当 /etc/init.d/supervisord 配置有改变时,需要首先,

    $ sudo systemctl daemon-reload

    然后再重启服务,

    $ sudo service supervisord stop
    $ sudo service supervisord start

    (完)

  • 相关阅读:
    HTML-body标签介绍-2
    HTML-body标签介绍-1
    HTML-简介及header
    中文字体编辑工具 Fontmin
    移动端点击复制文本 clipboard.js
    alert弹窗样式修改
    关闭微信页面与微信分享等配置
    Emmet 使用
    js cookie
    select 清除默认样式
  • 原文地址:https://www.cnblogs.com/gaowengang/p/14650283.html
Copyright © 2011-2022 走看看