Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get supervisorctl status of processes?

Tags:

linux

php

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.

like image 686
Lewis Avatar asked Nov 19 '22 12:11

Lewis


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

like image 114
Carlos.V Avatar answered Nov 21 '22 05:11

Carlos.V