troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
621 stars 61 forks source link

initctl status <name> should show all corresponding :id services not just the first one #275

Closed hongkongkiwi closed 2 years ago

hongkongkiwi commented 2 years ago

In my service setup, I have one name with multiple id's.

I'm missing a way to check the status of all services under a particular name.

I think it would make be helpful and logical if initctl status <name> shows not just one service status, but all of the status's relating to that name.

So if I was to write in bash it would be:

for ID in $(initctl ident $MYNAME); do
  initctl status "$ID"
done

Specific status can still be checked with initctl status <name>:<id> ofcourse, so hopefully it wouldn't be breaking anything.

I guess at the moment initctl status <name> just shows the first service defined in the config file which just depends on the order it's read.

What do you think?

hongkongkiwi commented 2 years ago

Or here's another idea this might be tidier, perhaps initctl status <name> could just show the same as initctl status but only specifically based on the name. Then if you want to drill down you can do initctl status <name>:<id> as now.

I would imagine that initctl -q status <name> would show as 0 only if all ids have success, otherwise 1, this is related to #273

troglobit commented 2 years ago

Yeah, I like the latter suggestion, that's pretty much what I'd too expect from a system :+1:

troglobit commented 2 years ago

Interesting, turns out we had something similar to this which was changed in e51587c6. I'll make sure to honor that change by splitting on :. Original implementation was in #197 ... kinda similar to this one :-/

A test will be added to protect against future regressions.