[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: No feedback from systemd / "systemctl stop X"... Nothing on stdout, nothing that `echo $?` can see...



On Wed, 11 Mar 2015, The Wanderer wrote:
> Running those commands doesn't give you output from 'systemctl stop
> foo' or the like, however.

> I thought the OP was asking how to determine, from the exit code
> and/or the console output of 'systemctl stop foo' (or a similar
> command, one that actually _alters_ the status of a service), whether
> the command actually succeeded.

If you want to know that, then do something like:

systemctl start foo && systemctl is-active foo;

or

systemctl stop foo && ! systemctl is-active foo && ! systemctl is-failed \
foo;

Presumably you could even write a shell function to do this if that's
something that you actually wanted.

> You can certainly run these commands afterwards, and get the status of
> the service that way, but that's no substitute for being able to get
> output or the like directly from the original control command.
> 
> Does systemd really not provide any "verbose" mode for its
> service-control commands, in which they report what they are doing?

No. Really, all systemctl start/stop do is tell systemd to actually stop
or start the service, and optionally block until the action is
completed.

I suppose someone could make an argument that including a verbose flag
or something might be useful, but considering that you can achieve
similar functionality with existing discrete tools, I'm not sure that
growing additional code and documentation to support such an option is
worth it.

Look at the definition of start_unit in
http://cgit.freedesktop.org/systemd/systemd/tree/src/systemctl/systemctl.c
for the current code.


-- 
Don Armstrong                      http://www.donarmstrong.com

Live and learn
or die and teach by example
 -- a softer world #625
    http://www.asofterworld.com/index.php?id=625


Reply to: