How to add a delay to supervised process in supervisor - linux

Zack S picture Zack S · Oct 13, 2014 · Viewed 19.3k times · Source

I added a bottle server that uses python's cassandra library, but it exits with this error:
Bottle FATAL Exited too quickly (process log may have details)
log shows this:
File "/usr/local/lib/python2.7/dist-packages/cassandra/cluster.py", line 1765, in _reconnect_internal raise NoHostAvailable("Unable to connect to any servers", errors)

So I tried to run it manually using supervisorctl start Bottle ,and then it started with no issue. The conclusion= Bottle service starts too fast (before the needed cassandra supervised service does): a delay is needed!

Answer

DeeY picture DeeY · May 12, 2015

This is what I use:

[program:uwsgi]
command=bash -c 'sleep 5 && uwsgi /etc/uwsgi.ini'