3👍
Your init.d script is referencing the system python package, not the virtualenv python. So when you are running celery inside it, you are referencing the one installed in your system site packages.
Add a reference to the virtualenv python path before calling celery and everything should work just fine.
That being said, it is usually better to use init.d to run supervisord and then have supervisord spin up all your other processes like celery and your web application.
2👍
When you execute a command using sudo sh
, you’re starting a completely new shell environment. Inside that environment, your virtualenv is not activated, and the virtualenv’s bin
directory will not be on the path, which is presumably why the executable is not found.
If you really need to run this as the superuser, you should create a wrapper script that executes the virtualenv inside the sudo
call.