我想在运行命令之前获取一个文件,但这不起作用。
[program:someprogram]
command=source /opt/pyenv.someenv/bin/activate && python scripts/some.py
directory=/root/p/somedir
autostart=true
autorestart=true
user=root
我之后,,,reread
它说update
status
supervisor> reread
someprogram: changed
supervisor> update
someprogram: stopped
someprogram: updated process group
supervisor> status
someprogram FATAL can't find command 'source'
我尝试过
command=. /opt/pyenv.someenv/bin/activate && python scripts/some.py
它说
someprogram FATAL command at '/usr/local/sbin/.' is a directory
答案1
也许尝试调用特定环境的 python 别名,我知道这至少是 Passenger 在执行 Django 时使用正确的虚拟环境的方式。
/opt/pyenv.someenv/bin/python /root/p/somedir/scripts/some.py
答案2
source
是 bash 的内置命令。因此你需要一个 bash shell。类似这样的命令:
[program:someprogram]
command=/bin/bash -c "source /opt/pyenv.someenv/bin/activate && python
scripts/some.py"