开发者

Multiple commands within Supervisor - Python/Linux

开发者 https://www.devze.com 2023-02-01 11:25 出处:网络
I\'m using the amazing utility supervisord I\'m happily running a few apps editing the config file as follows:

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 开发者_Python百科commands before they start up in order to prepare them for startup.

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


Any ideas?


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
0

精彩评论

暂无评论...
验证码 换一张
取 消