15

I am trying to understand the output of the service --status-all command on Ubuntu 13.10, since the man page doesn't explain it. For example:

[ + ]  rsyslog
[ - ]  sendmail
[ ? ]  sendsigs
[ + ]  setvtrgb
[ - ]  ssh

What do +, -, ? mean? I can't figure it out. I had sendmail installed before but I stopped and removed it with apt-get remove sendmail*. I guess that didn't get rid of the init script in /etc/init.d/ and that's why it shows it in the output, but at least it's a -, so I assume it's not running. Then, SSH. I'm actually SSH-ing into the server, so I assume the SSH service should be running, but it's a - there anyway. And then there's the cryptic ?. Somebody please shed some light on what this actually means.

p4sh4
  • 251
  • 1
  • 2
  • 7

1 Answers1

16

The service --status-all command tries to figure out for every init script in /etc/init.d if it supports a status command (by grepping the script for status).

If it doesn't find that string it will print [ ? ] for that service.

Otherwise it will run /etc/init.d/$application status.
If the return code is 0 it prints [ + ].
If it's not 0 it prints [ - ].

Why does ssh print [ - ] even though it's still running?
ssh is controlled by upstart in Ubuntu (13.10).
Running /etc/init.d/ssh status will produce no output and a return code of 1.

faker
  • 17,496
  • 2
  • 60
  • 70
  • Oh, upstart. Thanks for the detailed reply, `service --status-all` is much more clear to me now. So to get a full picture I should also use `initctl list` and kind of "or" the results together? Is there some more complete and comprehensive way? – p4sh4 Jul 20 '14 at 11:49
  • Yep use also `initctl list` or just general `ps ...`, at least until `systemd` is being used... – faker Jul 20 '14 at 11:57
  • Thanks for pointing out `systemd`, now I'm looking forward to 14.10... – p4sh4 Jul 20 '14 at 13:02
  • As far as I know 14.10 doesn't use `systemd` yet, but I'm not a Ubuntu guy. I could be wrong. – faker Jul 20 '14 at 13:03
  • 14.10 isn't out yet, they're planning to offer it as an alternative to `upstart` but both will work in the near future apparently – p4sh4 Jul 21 '14 at 06:05
  • Note that the output of `service --service-all` does **not** seem to guarantee to be the same as `service [service] status` (it *should*, usually, most of the time). see https://askubuntu.com/questions/860353/service-command-why-service-status-all-and-service-servicename-status-return ford etails – phil294 Jun 28 '17 at 06:01