skip to Main Content

Here’s are the commands i’m using to start my project:

nginx -s stop
workon my_project_env
pkill -f uwsgi -9
uwsgi -x /root/my_project/My_web_api/My_web_api.xml
deactivate
nginx

I want to make sure that this project starts even if the server reboots.

But writing a shell command file as xxx.sh is not going to work,

as shell command won’t simply work in virtualenv.

All of the command above will just work in the main terminal,

but some command must work on the virtualenv.

How can i work this out?

2

Answers


  1. Chosen as BEST ANSWER

    I found out that using souce ./xxx.sh will work(i used to use ./xxx.sh ), but with Akash Ranjan's help, i know that it is not the right way for situation like this.


  2. You will need to call the uwsgi command using the virtualenv’s file for uwsgi. that way you won’t need to activate the virtualenv.

    Something like below,

    /path/to/virtualenvs/project-name/bin/uwsgi -x /root/my_project/My_web_api/My_web_api.xml
    

    All the commands that need to be run using virtualenv should be called this way, so that you won’t need to activate the virtualenv.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search