RadiantHex
RadiantHex

Reputation: 25557

Multiple commands within Supervisor - Python/Linux

I'm using the amazing utility supervisord


I'm happily running a few apps editing the config file as follows:

[program: Django Dev Server]
command=python /path/to/project/manage.py runserver 127.0.0.1:8000

[program: MongoDB]
command=sudo /path/to/mongod

Now problem is that some apps need a few commands before they start up in order to prepare them for startup.

e.g. verifying conditions, cleaning folders, etc...


Any ideas?

Upvotes: 5

Views: 6263

Answers (1)

unutbu
unutbu

Reputation: 879481

Instead of calling manage.py, write a script (call it, say, start_manage.py) which verifies conditions, cleans folders, etc, and then calls manage.py (using subprocess.Popen). Or, of course, start_manage could be a shell script if that fits your needs better.

Then change the config file to run

command=python start_manage.py

Upvotes: 8

Related Questions