【问题标题】:Could not find an ansible playbook when running script using supervisor使用主管运行脚本时找不到 ansible 剧本
【发布时间】:2016-02-09 04:41:17
【问题描述】:

我对 supervisord 比较陌生。我正在尝试使用 supervisord 将我的 python 脚本作为守护进程运行。以下是我放在/etc/supervisor/conf.d的conf文件

[program:myscript]
command=/usr/bin/python /etc/supervisor/conf.d/main.py
user=ubuntu
autostart=true
autorestart=true
stderr_logfile=/var/log/stagingbot.err.log
stdout_logfile=/var/log/stagingbot.out.log

在我的main.py 中,有一个子进程将调用同样位于/etc/supervisor/conf.d 的ansible playbook,名为start.yml。但是,我收到一条错误消息,提示找不到特定的 yml。 Error: the playbook: start.yml could not be found

另一方面,当我使用 python main.py & 运行我的脚本时,它可以正常工作,因为它可以找到 ansible 剧本。

任何帮助将不胜感激。谢谢你

【问题讨论】:

    标签: python-2.7 ansible supervisord


    【解决方案1】:

    您是否尝试 chdir 进入该位置?

    [program:myscript]
    command=/usr/bin/python /etc/supervisor/conf.d/main.py
    directory=/etc/supervisor/conf.d
    ...
    

    【讨论】:

    • 嘿@udondan,非常感谢。添加directory=/etc/supervisor/conf.d 后,它现在可以完美运行了。非常感谢
    猜你喜欢
    • 1970-01-01
    • 2016-08-30
    • 2022-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多