How to get supervisorctl status of processes?

Viewed 21100

I have supervisorctl running with about 50 processes. Now I want to get the status of these processes on my website. My idea is to use on php exec(“sudo supervisorctl status”) and set the output to a array or something like that. I only need the first 2 colons.

process1                         RUNNING    pid 935, uptime 17386 days, 14:52:25
process2                         RUNNING    pid 936, uptime 17386 days, 14:52:25
process3                         RUNNING    pid 31907, uptime 0:00:09

What is the best way to do this.

1 Answers

You can use a regular expression to extract the first two fields in the outpu. Or you could use supervisorctl status | awk '{print $1, $2}'

Credits to @Barmar

Related