[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...



Am 2015-03-11 22:16, schrieb Martinx - ジェームズ:
Hey guys,

 With SysVinit or Upstart, when we stop/start a service, we can see a
feedback from the command output. Like "service blah stopping..."

 Also, we can use, for example, `echo $?`, after the command, to see
if it was executed according, or not, for example:

 cat /etc/passwd
 echo $?
 0

 cat /etc/blah
 echo $?
 1

 But, I'm not seeing the same behavior when using systemd commands...
I mean, how can I "track" systemd if it does provides any kind of
"usual" outputs to stdout?


What you describe, is only partially correct.

The return code of systemctl start/stop/restart etc, does actually indicate success or failure, as Christian Seiler already mentioned.

systemctl, like any good unix tool, simply is silent if there is nothing to report.

Having a --verbose switch might indeed be a useful addition, but I think it shouldn't be the default behaviour.

As for the behaviour during boot, it's similar: By default, if everything is fine and there is nothing to report, systemd is silent. It will automatically switch into verbose mode those, if a service fails or hits a timeout, i.e. takes a long time to start.


You can control that behaviour though.
If you want a sysvinit like behaviour, I'd suggest keeping the "quiet" kernel command line parameter. If you remove it, the boot screen will be splattered with kernel messages.

Instead, add "systemd.show_status=true" to the kernel command line (e.g. via /etc/default/grub).

See man systemd, section "KERNEL COMMAND LINE"

Cheers,
Michael




Reply to: