在Ubuntu 18.04.1 LTS上,我已使用pipenv
安装了pip3
。我还安装了supervisor
。
我的目标:
我希望主管运行包含test.sh
命令的pipenv run
脚本。
我的test.sh
脚本:
#!/bin/bash
/root/local/bin/pipenv run echo "2222222"
我在/etc/supervisor/conf.d/mysite.conf
中的主管配置:
[program:mysite]
command = /var/www/mysite/test.sh
user = root
stdout_logfile = /var/www/mysite/.gunicorn/logs/gunicorn_supervisor.log
redirect_stderr = true
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8
我的问题:
当我直接从控制台运行/var/www/mysite/test.sh
时,一切正常。但是,如果主管使用上面的config运行我的bash脚本,则会引发以下毫无头绪的跟踪。
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pipenv/cli/command.py", line 396, in run
command=command, args=args, three=state.three, python=state.python, pypi_mirror=state.pypi_mirror
File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 2217, in do_run
ensure_project(three=three, python=python, validate=False, pypi_mirror=pypi_mirror)
File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 601, in ensure_project
validate=validate, skip_requirements=skip_requirements, system=system
File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 324, in ensure_pipfile
project.create_pipfile(python=python)
File "/usr/local/lib/python3.6/dist-packages/pipenv/project.py", line 644, in create_pipfile
config_parser = ConfigOptionParser(name=self.name)
File "/usr/local/lib/python3.6/dist-packages/pipenv/patched/notpip/_internal/baseparser.py", line 141, in __init__
assert self.name
AssertionError
任何想法为何主管无法正确启动我的bash脚本?我怀疑这是因为pipenv在由主管启动时缺少某些环境变量。
请注意,我的所有路径都是绝对路径,如此处建议的:set up pipenv with supervisor