Restarting supervisord processes in parallel

At Private Packagist we manage some of our background processes with Supervisor. It comes with a command line interface supervisorctl which has an option to restart a group of processes. The way this works is by sending the respective signal to all processes, waiting for them to terminate and then starting them all up again. The way we called this so far is as follows:

supervisorctl signal INT packagist:*
supervisorctl restart packagist:*

As a consequence if you have some processes which take a while before they shut down all other process are already shut down and won’t get started up again yet. For us this happens because some processes may be in the middle of some work we don’t want to interrupt. So instead we want all processes to start up again immediately after they are stopped. My solution uses GNU parallel to run supervisorctl restart in parallel for each of our processes:

supervisorctl signal INT packagist:*
supervisorctl avail | cut -f 1 -d " "|grep packagist:| parallel supervisorctl restart {}

Hope this can be of help to someone looking for a solution to the same problem!