Bug#887501: systemctl status should not use --pager

Guido Günther agx at sigxcpu.org
Fri Jan 19 15:57:51 GMT 2018


Hi Michael,
On Wed, Jan 17, 2018 at 04:19:58PM +0100, Michael Biebl wrote:
[..snip..]
> I quickly checked "service" from a Fedora installation. It doesn't seem
> to use --no-pager (see the attached files).
> 
> Does service really behave differently on other distros?

At least the last CentOS and SLES releases I used didn't show that behaviour.

> >> Second, for your use case, directly using
> >> systemctl is-active $service
> >> seems like a better idea anyway then to use a full-blown systemctl
> >> status output as it would be much quicker.
> > 
> > serverspec uses exactly this when it you tell it the init system is
> > systemd
> > 
> >   describe service('openssh-server') do
> >     it { should be_running.under('systemd') }
> >   end
> > 
> > and this works out of the box. But there are situtation when one doesn't
> > care about the init system and using service is good enough. (The fact
> > that Debian ships several init systems doesn't make things simpler).
> 
> But you know which system does use systemd, so you could setup the
> servespec config accordingly to use "is-active"?

I do, but serverspec doesn't care. Isn't service there to provide this
kind of abstraction?

> >> Third, afaik, systemctl has some auto-detection whether it is called
> >> from an interactive shell or not and is not supposed to use paging in
> >> that case. Might be worth investigating if that is not working or if I'm
> >> just misinformed there.
> > 
> > serverspec is trying to mimic an interactive session here which seems to
> > confuse systemctl.
> 
> Urgh...
> 
> >> Fourght, you already have a knob where you can disable the pager. See
> >> the systemctl man page → ENVIRONMENT. Setting $SYSTEMD_PAGER to an empty
> >> var should disable the pager.
> >>
> >> Given all those reasons, I don't think we should change the behaviour of
> >> "service $foo status"
> > 
> > My main point would be better matching the behavior of other distros.
> 
> See above. I'm not sure if other distros actually behave differently.
> Would like to know more if you have any references.

E.g. the service command in centos6

   https://centos.pkgs.org/6/centos-updates-x86_64/initscripts-9.03.58-1.el6.centos.1.x86_64.rpm.html

Cheers,
 -- Guido




More information about the Pkg-systemd-maintainers mailing list