I am using supervisord
inside a Docker container to manage my running processes and would like to also use it to trigger certain commands – run them once and expect them to exit with 0
.
Here's one example:
[program:central-seed-posts]
command = /usr/bin/php /var/www/app/artisan post
autostart = false
autorestart = false
startsecs = 3
startretries = 0
exitcodes = 0
stderr_logfile=/tmp/central/posts-stderr-supervisor.log
stdout_logfile=/tmp/central/posts-stdout-supervisor.log
And I'm using nsenter's docker-enter
with supervisorctl start central-seed-posts
to trigger it but I would also like to handle a successful exit instead of supervisor telling me ERROR (abnormal termination)
Does it have to do with supervisor events ?
Best Answer
Problem you are encountering seems to be with the following option you use:
If you read manual of supervisord, you can see that startsecs sets for how long the process has to stay alive after a startup for Supervisord to consider the start successful. Your process is probably exiting before 3 secs, which suggests to supervisord that startup was not successful.
Try lowering that to 0, unless you have a real reason to keep it 3 sec.