获取FileNotFoundError: [Errno 2] No such file or directory: 'bash'错误而运行我gunicorn Python应用程序的形式。服务文件。
但是,单独运行 gunicorn 命令(不是从 .service 文件)运行正常。
运行应用程序的 gunicorn 命令
gunicorn -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 --bind <server_ip>:8080 wsgi
app.service 文件
[Service]
User=user
WorkingDirectory=/home/user/app
Environment="PATH=/home/user/app/app_venv/bin"
ExecStart=/home/user/app/app_venv/bin/gunicorn -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker --workers 1 --bind <server_ip>:8080 wsgi
生成错误的 Python 代码
import subprocess
cmd = ['bash', 'script.sh' , args.get('arg')]
try:
process = subprocess.Popen(cmd,
cwd=/path/to/bash_script,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True)
while process.poll() is None:
output = process.stdout.readline()
if(output==''):
break
emit('tg_output', output)
except subprocess.CalledProcessError as error:
pass
叮当猫咪
MYYA
相关分类