troglobit / finit

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

initctl signal and other commands should support -q #266

Closed hongkongkiwi closed 2 years ago

hongkongkiwi commented 2 years ago

I have some services which may or may not be available when I want to send a signal. (they are being sent signals very early via mdev) The debug output is quite noisy.

I propose that initctl signal, reload, restart, stop/start should support a -q flag which simply returns an error code if the service doesn't exist rather than any error message. This is very useful for scripts where we don't need the error message just the return code.

Here's what happens without -q

# initctl -q signal test 9
No such task or service(s): test

Usage: initctl signal <NAME>[:ID] <S>
troglobit commented 2 years ago

Excellent point, thanks!

troglobit commented 2 years ago

There fixed. As an added bonus I've audited and aligned the exit codes with LSB and BSD sysexits.h, same as detailed in systemd.exec(5).

hongkongkiwi commented 2 years ago

Thanks! Very helpful.