There are some critical processes in my php-worker docker I need to make sure supervisor starts them correctly, if not I will need to restart my docker.
I have searched the supervisor document but I can't find an easy way to record all the FATAL processes by supervisor. So now I write TWO cronjob , first to check supervisorctl output periodically, something like this,
supervisorctl status | awk '{if ($2 =="FATAL") {split($1,a,":"); print a[1]}}'
// If the output is not empty I record the process name into a file
The second cronjob to check periodically if that particular file exists and if the critical process I need exists in this file.
I feel awkward for this home-made solution. So is there a better way to do this ?
BTW, what I want is to find a way to record all the FATAL process but NOT to let supervisorctl restart them (I know how to do that, e.g. a simple modification to my script)
PS, I also searched SO and only find this How to get supervisorctl status of processes?, which is not what I need.