运行 脚本使用 supervisor 时找不到 ansible playbook

Could not find an ansible playbook when running script using supervisor

我对 supervisord 比较陌生。我正在尝试 运行 我的 python 脚本作为使用 supervisord 的守护进程。以下是我放在 /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 中,有一个子进程将调用一个 ansible 剧本,它也位于 /etc/supervisor/conf.d,名为 start.yml。但是,我收到一条错误消息,指出找不到特定的 yml。 Error: the playbook: start.yml could not be found

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

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

您是否尝试将 chdir 放入该位置?

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