The behaviour of systemctl.

Michal Hlavinka mhlavink at redhat.com
Mon Jun 20 09:12:03 UTC 2011


On 06/17/2011 10:16 PM, Aaron Sowry wrote:
> Hello,
>
> I'd like to discuss the behaviour of systemctl. See RH bug 713567 for context. To summarise:
>
> - 'systemctl --all' pages by default when the output is to tty. This consumes 50-60+ lines of potentially bug-prone code, and irks the crap out of me as a system administrator. systemctl's jurisdiction ends at stdout.
>
> - The same command outputs column headers on tty, and no headers otherwise. This is inconsistent. If I am outputting to a file, or perhaps a printer, and want headers on my non-tty output, I have to add them myself since there is no flag to force them on non-tty channels. If I don't want them and they are present, I tail.
>
> - Currently, if I run 'systemctl --all' and have no pager (at least no pager that systemctl knows of) available, I get an error message and no output. This is horribly bad form, and forces me to use --no-pager or pipe to cat in order to get output. This issue is acknowledged in RH bug 713707.
>
> - Another bright idea (RH bug 713567) is that --full should be applied to non-tty output automatically, and not to tty output.
>
> All of these peculiarities stem from poor UNIX programming practise. Do not try to make decisions for me as a user (especially not based on output channels), about how I want my output formatted. No other Linux/UNIX tools make this assumption (with perhaps the exception of git-log et. al.), and if you are wanting administrators to feel comfortable with your new soon-to-be-ubiquitous tools, then I suggest you try to be consistent with existing convention. I don't want to have to check man pages to see if piping output gives me different results than tty, and I would rather use existing, well-proven tools to format my output than a bunch of flags I have to re-learn just to be able to deal with systemctl. The type of people using systemctl are not the type of people that are going to need hand-holding.
>
> Thanks.
>

I'll add one (small) inconsistency:

# systemctl is-active <service>

has following output:
 > active
and sets exit code. If you don't wont any output, you need to use "--quiet"

# systemctl is-enabled <service>
just sets exit code.

I'd prefer if the behaviour of "is-active" and "is-enabled" is the same: 
simple output and "--quiet" option.


More information about the devel mailing list