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

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


This is what I use:

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


Not happy enough with the sleep hack I created a startup script and launched supervisorctl start processname from there.

[program:startup]command=/startup.shstartsecs = 0autostart = trueautorestart = falsestartretries = 1priority=1[program:myapp]command=/home/website/venv/bin/gunicorn /home/website/myapp/app.pyautostart=falseautorestart=trueprocess_name=myapp

startup.sh

#!/bin/bashsleep 5supervisorctrl start myapp

This way supervisor will fire the startup script once and this will start myapp after 5 seconds, mind the autostart=false and autorestart=true on myapp.