I am executing some PHP script with supervisord. Sometimes one of my processes is stopping with error log:
INFO exited: worker_push_notif (exit status 0; expected). I already set in config autorestart=true but still, I have to restart it manually. Below is my full config:
[program:worker_push_notif] directory = /opt/initproject/workers command = /usr/bin/php /opt/initproject/workers/fcm_pushnotif.php autostart=true autorestart=true startretries=3 stdout_logfile = /var/log/initproject/pushnotif.log stderr_logfile = /var/log/initproject/pushnotif.err Need help to handle autorestart for exit status 0. Thank you.
Note: Ubuntu 14.04, Supervisord 3.0
1 Answer
When working out the same problem I created a simple launcher script that returned 1. I called then the launcher script instead of directly calling the original script. That was enough to trick supervisord. I assume there is a cleaner way, but couldn't find it in the docs.
#!/bin/bash /path/to/your/script exit 1